
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
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)) }
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务