question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

can't open a receiver bound to application header x-match expression

See original GitHub issue

I’m trying to adapt https://github.com/amqp/rhea/tree/master/examples/selector example using an x-match expression instead of a JMS expression. Tried this code:

connection.open_receiver({
	source: {
		address: 'amq.match',
		filter: {
			'x-match': 'all',
			value: {
				'nat': 'it',
				'prod': 'a22'
			}
		}
	}
})

Received “connection_error Expected value type is ‘Filter’ but got ‘String’ amqp:decode-error” from Qpidd Java broker (rel. 7.1.0).

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
k-wallcommented, Mar 6, 2019

@k-wall I tried JMS filters (example here on rhea repo) and they work fine with Qpid Broker-J but using “amq.topic” exchange instead of “amq.match” (so strange)

@beaver71 The exchange concept comes from the old pre-AMQP 1.0 world (AMQP 0-x). It was those specifications that defined the behaviour of how instances of the in-built exchange types worked. amq.match (which is an instance of the “header” exchange type) was never defined as understanding message selectors. The exchange concept does not exist in AMQP 1.0 so you won’t find the concept in other AMQP providers. Apache Qpid did this to help is legacy user move to the new world.

I generally encourage message users to utilise standard messaging features when building their applications. So I echo @grs comments to use message selectors if you can for your use-case.

1reaction
grscommented, Mar 4, 2019

This works with the qpid c++ broker:

var container = require('rhea');
var types = require('rhea').types;

var args = require('../options.js').options({
    'h': { alias: 'host', default: 'localhost', describe: 'dns or ip name of server where you want to connect'},
    'p': { alias: 'port', default: 5672, describe: 'port to connect to'}
}).help('help').argv;

container.on('message', function (context) {
    console.log(context.message.body);
});

container.once('sendable', function (context) {
    context.sender.send({application_properties:{'a': 'foo', 'b': 'bar'}, body:'first matches'});
    context.sender.send({application_properties:{'y': 'foo', 'b': 'bar'}, body:'second does not match'});
    context.sender.send({application_properties:{'a': 'foo', 'b': 'bar', 'x':'y'}, body:'third matches'});
    context.sender.send({application_properties:{'a': 'foox', 'bx': 'bar'}, body:'fourth does not match'});
});

var con = container.connect({ port: args.port, host: args.host });
con.open_receiver({source:{address:'amq.match', filter:{'foo':types.wrap_described({'a': 'foo', 'b': 'bar', 'x-match': 'all'}, 0x468C00000002)}}});
con.open_sender({target:{address:'amq.match'}});

ActiveMQ does not support the headers exchange or this particular filter. The qpid java broker does support the headers exchange but I am not sure if it supports this filter definition. I’ll try and find out - certainly the code above does not work against that broker.

Read more comments on GitHub >

github_iconTop Results From Across the Web

can't open a receiver bound to application header x-match ...
I'm trying to adapt https://github.com/amqp/rhea/tree/master/examples/selector example using an x-match expression instead of a JMS expression.
Read more >
Excel XMATCH function with formula examples - Ablebits
The XMATCH function is case-insensitive by nature and cannot distinguish the letter case. To distinguish lowercase and uppercase characters, ...
Read more >
Part 4: RabbitMQ Exchanges, routing keys and bindings
An exchange is responsible for routing the messages to different queues with the help of header attributes, bindings, and routing keys.
Read more >
3. Reference - Spring
For the header exchange, we set the binding arguments to match messages that have the header foo set to bar and the header...
Read more >
AMQP 0-9-1 Model Explained - RabbitMQ
Messaging brokers receive messages from publishers (applications that publish them ... that are more easily expressed as message headers than a routing key....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found