Este conteúdo não está disponível no idioma selecionado.

4.10.6. Subscribe to a Headers Exchange


Changes
  • Updated April 2013.
  • Updated July 2013.
The following code creates a queue match-q, and subscribes it to the amq.match exchange using a binding key that matches messages that have a header key header1 with a value of value1:
AMQP 0-10

Python
rxheaders = ssn.receiver("match-q;{create: always, node: {type: queue}, link:{x-bindings:[{key: 'binding-name', exchange: 'amq.match', queue: 'match-q', arguments:{'x-match': 'any', 'header1': 'value1'}}]}}")
Copy to Clipboard Toggle word wrap

AMQP 1.0

C++
Receiver rxheaders = ssn.createReceiver("amq.match; {link: {name:match-q, filter:{value:{'x-match': 'any', 'header1': 'value1'}, name: headers, descriptor:'apache.org:legacy-amqp-headers-binding:map'}}}");
Copy to Clipboard Toggle word wrap

The x-match argument can take the values any, which matches messages with any of the key value pairs in the binding, or all, which matches messages that have all the key value pairs from the binding key in their header.
Note that you cannot match against multiple values for the same header. You can use multiple headers with different values, but only one value can be matched against a particular header.
AMQP 1.0 does not support link-scoped x-binding, and so a filter is used.
AMQP 0-10 uses a link-scoped x-binding. Note the x-bindings argument key. This argument creates a named handle for the binding, which is visible when running qpid-config exchanges -r. Without a handle, a binding cannot be deleted by name. A null key is valid, but in addition to not being able to be deleted by name, when a binding is created with a null handle, any further attempt to create a binding with a null handle on that exchange will be update the existing binding rather than create a new one.
Voltar ao topo
Red Hat logoGithubredditYoutubeTwitter

Aprender

Experimente, compre e venda

Comunidades

Sobre a documentação da Red Hat

Ajudamos os usuários da Red Hat a inovar e atingir seus objetivos com nossos produtos e serviços com conteúdo em que podem confiar. Explore nossas atualizações recentes.

Tornando o open source mais inclusivo

A Red Hat está comprometida em substituir a linguagem problemática em nosso código, documentação e propriedades da web. Para mais detalhes veja o Blog da Red Hat.

Sobre a Red Hat

Fornecemos soluções robustas que facilitam o trabalho das empresas em plataformas e ambientes, desde o data center principal até a borda da rede.

Theme

© 2025 Red Hat