本文介绍了RabbitMQ:如何在页眉交换中使用复杂的表达式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是死信队列"中邮件的标题.我正在使用RabbitMQ.

Bellow are the headers of a message in a Dead Letter Queue. I'm using RabbitMQ.

__TypeId__: com.example.queue.TesteDTO
correlationId:  dfbc9457-8de6-9b77-b7ad-b259d1e2ede4
sequenceNumber: 1
sequenceSize:   2
x-death:
  count:    1
    reason: rejected
    queue:  queue.raffael.teste
    time:   1478870283
    exchange:
    routing-keys:   queue.raffael.teste

我想使用一个复杂的表达式声明并绑定Header Exchange,例如:

I want to declare and bind a Header Exchange using a complex expression, say:

x-match = any
x-death[0].count = 1
x-death[0].count = 2
x-death[0].count = 3

但是它不起作用.它似乎仅适用于简单的表达式:

But it doesn't work. It seems to work only for simple expressions:

x-match = any
simpleExpression = 1
simpleExpression = 2
simpleExpression = 3

那么,请问如何在Header Exchange(RabbitMQ)中引用数组索引和组件而不是简单的表达式?

So, please, how to make references to array indexes and components instead of just simple expressions in Header Exchanges (RabbitMQ)?

推荐答案

在AMQP规范中,单词点"仅与路由密钥有关. Headers Exchange不应解析参数键.如果存在带有字符串键"x-death [0] .count"和数字值1的标头,则它将匹配,但是只有带有字符串键"x-death"的标头和类型为:表数组.

The word "dot" occurs in the AMQP spec only in regard to the routing key. The Headers Exchange is not supposed to parse the arguments keys. If there was a header with a string key "x-death[0].count" and a numeric value value 1, it would match, but there's only a header with a string key "x-death" and a value with type: array of tables.

这篇关于RabbitMQ:如何在页眉交换中使用复杂的表达式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 04:21