rabbitmq 活页夹中的自定义 DLX 选项
Custom DLX options in rabbitmq binder
我正在使用 spring-cloud-stream 在微服务之间进行通信。我在 rabbit mq 代理中有以下预定义设置。
"first" -> exchange of type Topic which is bound to Queue (name="user.create",x-dead-letter-exchange="first.dlx")
"first.dlx" -> dead letter exchange of type Topic
和以下配置文件:
spring:
cloud:
stream:
bindings:
consumer-input:
group: user.create
destination: first
contentType: application/json
binder: rabbit
binders:
rabbit:
type: rabbit
rabbit:
bindings:
consumer-input:
consumer:
acknowledgeMode: manual
declareExchange: false
queueNameGroupOnly: true
bindQueue: false
deadLetterExchange: first.dlx
autoBindDlq: true
deadLetterRoutingKey: user.create.dlq
当我启动应用程序时说:
[AMQP Connection 127.0.0.1:5672] ERROR o.s.a.r.c.CachingConnectionFactory - Channel shutdown: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'type' for exchange 'first.dlx' in vhost '/': received 'direct' but current is 'topic', class-id=40, method-id=10)
因为 rabbit mq 尝试声明类型 "direct" 的 dlx。这里是 repo 的 link。
所以我的问题是……有什么方法可以告诉 rabbit mq 声明除 "direct" 之外的其他类型的 dlx,例如 属性 名称:"deadLetterExchangeType: topic"?或者根本不声明 dlx。
任何其他建议都会很有帮助。
目前无法定义 DLX 交换类型或阻止其声明。请开一个issue against the binder.
仅仅允许指定类型可能还不够,因为它可能有其他不兼容的参数。我们应该添加 declareDlx
,类似于 declareExchange
.
我正在使用 spring-cloud-stream 在微服务之间进行通信。我在 rabbit mq 代理中有以下预定义设置。
"first" -> exchange of type Topic which is bound to Queue (name="user.create",x-dead-letter-exchange="first.dlx")
"first.dlx" -> dead letter exchange of type Topic
和以下配置文件:
spring:
cloud:
stream:
bindings:
consumer-input:
group: user.create
destination: first
contentType: application/json
binder: rabbit
binders:
rabbit:
type: rabbit
rabbit:
bindings:
consumer-input:
consumer:
acknowledgeMode: manual
declareExchange: false
queueNameGroupOnly: true
bindQueue: false
deadLetterExchange: first.dlx
autoBindDlq: true
deadLetterRoutingKey: user.create.dlq
当我启动应用程序时说:
[AMQP Connection 127.0.0.1:5672] ERROR o.s.a.r.c.CachingConnectionFactory - Channel shutdown: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'type' for exchange 'first.dlx' in vhost '/': received 'direct' but current is 'topic', class-id=40, method-id=10)
因为 rabbit mq 尝试声明类型 "direct" 的 dlx。这里是 repo 的 link。
所以我的问题是……有什么方法可以告诉 rabbit mq 声明除 "direct" 之外的其他类型的 dlx,例如 属性 名称:"deadLetterExchangeType: topic"?或者根本不声明 dlx。
任何其他建议都会很有帮助。
目前无法定义 DLX 交换类型或阻止其声明。请开一个issue against the binder.
仅仅允许指定类型可能还不够,因为它可能有其他不兼容的参数。我们应该添加 declareDlx
,类似于 declareExchange
.