
RADAR Push Endpoint是一个提供REST接口的服务,用于将基于推送订阅的API连接到Apache Kafka。目前已集成Garmin健康数据推送服务,并支持通过扩展机制添加其他推送服务,适用于RADAR-base生态系统中的数据集成场景。
推送服务集成通过YAML配置文件进行设置,基本结构如下:
yamlpushIntegration: # 推送服务特定配置 garmin: enabled: true userRepositoryClass: "org.radarbase.push.integration.garmin.user.ServiceUserRepository" service-n: # 其他服务配置示例 enabled: true property-xyz: "value"
基础配置
yamlpushIntegration: garmin: enabled: true userRepositoryClass: org.radarbase.push.integration.garmin.user.ServiceUserRepository
使用GarminServiceUserRepository
若使用GarminServiceUserRepository,需先在管理门户创建OAuth客户端,配置以下属性:
client_id: your_client_id client_secret: your_client_secret grant_type: client_credentials resources: res_restAuthorizer scope: "SUBJECT.READ", "MEASUREMENT.READ", "SUBJECT.UPDATE", "MEASUREMENT.CREATE"
然后配置YAML属性:
yamlpushIntegration: garmin: enabled: true userRepositoryClass: org.radarbase.push.integration.garmin.user.GarminServiceUserRepository userRepositoryUrl: "http://radar-rest-sources-backend:8090/rest-sources/backend/" # 根据部署修改 userRepositoryClientId: "your_client_id" userRepositoryClientSecret: "your_client_secret" userRepositoryTokenUrl: "http://managementportal-app:8080/oauth/token/" # 根据部署修改
使用Docker Compose启动服务:
shelldocker-compose up -d --build
待Kafka就绪后,创建数据接收主题:
shellTOPIC=test # 替换为实际主题名 docker-compose exec kafka-1 kafka-topics --create --topic $TOPIC --bootstrap-server kafka-1:9092
服务默认通过http://localhost:8090/push/integrations/访问。Garmin具体端点包括:
http://localhost:8090/push/integrations/garmin/dailieshttp://localhost:8090/push/integrations/garmin/activitieshttp://localhost:8090/push/integrations/garmin/activityDetailshttp://localhost:8090/push/integrations/garmin/manualActivitieshttp://localhost:8090/push/integrations/garmin/epochshttp://localhost:8090/push/integrations/garmin/sleepshttp://localhost:8090/push/integrations/garmin/bodyCompositionshttp://localhost:8090/push/integrations/garmin/stresshttp://localhost:8090/push/integrations/garmin/userMetricshttp://localhost:8090/push/integrations/garmin/moveIQhttp://localhost:8090/push/integrations/garmin/pulseOxhttp://localhost:8090/push/integrations/garmin/respirationhttp://localhost:8090/push/integrations/garmin/deregister新推送服务集成需实现于org.radarbase.push.integration.<service-name>包,主要包括以下组件:
1. 创建资源类
定义服务所需的REST端点,参考GarminPushEndpoint实现。
2. 实现用户仓库
创建实现UserRepository接口的类,提供用户信息查询功能。
3. 实现认证验证器
创建实现radar-jersey库中https://github.com/RADAR-base/radar-jersey/blob/master/src/main/kotlin/org/radarbase/jersey/auth/AuthValidator.kt%E6%8E%A5%E5%8F%A3%E7%9A%84%E7%B1%BB%EF%BC%8C%E5%A4%84%E7%90%86%E8%AF%B7%E6%B1%82%E8%AE%A4%E8%AF%81%E3%80%82
4. 创建资源增强器
注册服务组件到Jersey上下文:
kotlinclass ServiceXIntegrationResourceEnhancer(private val config: Config) : JerseyResourceEnhancer { override fun ResourceConfig.enhance() { packages( "org.radarbase.push.integration.servicex.resource", "org.radarbase.push.integration.servicex.filter" ) } override fun AbstractBinder.enhance() { bind(config.pushIntegration.servicex.userRepository) .to(UserRepository::class.java) .named("servicex") .`in`(Singleton::class.java) bind(ServiceXAuthValidator::class.java) .to(AuthValidator::class.java) .named("servicex") .`in`(Singleton::class.java) } }
5. 配置认证委托
在DelegatedAuthValidator中添加服务路由:
kotlinfun delegate(): AuthValidator { return when { uriInfo.matches(GARMIN_QUALIFIER) -> namedValidators.named(GARMIN_QUALIFIER).get() uriInfo.matches("servicex") -> namedValidators.named("servicex").get() // 添加新服务路由 else -> throw IllegalStateException() } }
6. 添加配置类
在Config中添加服务配置:
kotlindata class PushIntegrationConfig( val garmin: GarminConfig = GarminConfig(), val servicex: ServiceXConfig // 新服务配置 ) data class ServiceXConfig( val enabled: Boolean = false, val userRepositoryClass: String, val property1: String, // 服务特定属性 val property2: List<String> )
7. 注册资源增强器
在PushIntegrationEnhancerFactory中注册新服务:
kotlinif(config.pushIntegration.servicex.enabled) { enhancersList.add(ServiceXIntegrationResourceEnhancer(config)) }
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。



探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
无需登录使用专属域名
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
Harbor Proxy Repository 对接专属域名
Portainer Registries 加速拉取
Nexus3 Docker Proxy 内网缓存
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
docker search 限制
站内搜不到镜像
离线 save/load
插件要用 plugin install
WSL 拉取慢
安全与 digest
新手拉取配置
镜像合规机制
manifest unknown
no matching manifest(架构)
invalid tar header(解压)
TLS 证书失败
DNS 超时
域名连通性排查
410 Gone 排查
402 与流量用尽
401 认证失败
429 限流
D-Bus 凭证提示
413 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务