|
该版本仍在开发中,尚未被视为稳定。对于最新稳定版本,请使用 spring-cloud-bus 5.0.0! |
配置
定制消息代理
春云总线使用春云流
广播这些信息。所以,要让消息流畅,你只需要包含活页夹
在类路径中实现你选择的。公交车有方便的起跑器
与AMQP(RabbitMQ)和Kafka(Spring-cloud-starter-bus-[AMQP|Kafka]).一般
说实话,Spring Cloud Stream 依赖于
配置中间件。例如,AMQP经纪人地址可以更改为Spring.兔子问题。*配置属性。春云巴士有几辆
本地配置属性春云.bus.*(例如,Spring.cloud.bus.destination是用作外部的主题名称
中间件)。通常,默认设置就足够了。
想了解更多如何自定义消息代理设置的信息,请查阅Spring Cloud。 流式文档。
追踪巴士活动
总线事件(的子类)RemoteApplicationEvent)可以通过设置来追踪spring.cloud.bus.trace.enabled=true.如果你这样做了,Spring靴追踪仓库(如果存在的话)显示每个发送的事件以及每个服务实例的所有确认地址。这
以下示例来自/跟踪端点:
{
"timestamp": "2015-11-26T10:24:44.411+0000",
"info": {
"signal": "spring.cloud.bus.ack",
"type": "RefreshRemoteApplicationEvent",
"id": "c4d374b7-58ea-4928-a312-31984def293b",
"origin": "stores:8081",
"destination": "*:**"
}
},
{
"timestamp": "2015-11-26T10:24:41.864+0000",
"info": {
"signal": "spring.cloud.bus.sent",
"type": "RefreshRemoteApplicationEvent",
"id": "c4d374b7-58ea-4928-a312-31984def293b",
"origin": "customers:9000",
"destination": "*:**"
}
},
{
"timestamp": "2015-11-26T10:24:41.862+0000",
"info": {
"signal": "spring.cloud.bus.ack",
"type": "RefreshRemoteApplicationEvent",
"id": "c4d374b7-58ea-4928-a312-31984def293b",
"origin": "customers:9000",
"destination": "*:**"
}
}
前面的迹表明RefreshRemoteApplicationEvent是从这里发出的客户:9000,向所有服务广播,并接收(ACK)的客户:9000和商店:8081.
如果你想自己处理ack信号,可以添加一个@EventListener对于AckRemoteApplicationEvent和SentApplicationEvent输入你的应用(并启用
描图)。或者,你也可以接入追踪仓库并挖掘数据
那里。
| 任何总线应用都可以追踪 ACK。然而,有时候确实如此 在能处理更复杂事务的中央服务中,这样做很有用 查询数据或转发给专业的追踪服务。 |