Assert Durable Queues Into Existence Via AMQP?

Hello,

I'm used to RabbitMQ / AMQP 0-9-1. Clients with the right credentials can assert queues into existence and bind them to multiple topic bindings. Clients can specify if queues are durable etc. It's quite convenient.

I'm trying to get the same thing working in Solace via AMQP 1.0. Sorry but I'm not super familiar with the 1.0 protocol.

I'm using NodeJS and I decided to use the

library instead of the one linked in solace docs. The amqp10 nodejs package has almost zero activity and no downloads so I went with rhea.

Here's some simple code I'm working with:

const container = require('rhea');

const connection = container.connect({

host: 'xxx.messaging.solace.cloud',

port: 5671,

username: 'solace-cloud-client',

password: 'xxx',

transport: 'tls'

});


container.on('message', function (context) {

console.log(`context.message=${JSON.stringify(context.message)}`);

});

const reciever = connection.open_receiver({

name: `test-amqp-one`,

source: { address: 'topic://hooray/*/>', durable: 2, expiry_policy: 'never', capabilities: ['topic'] }

});

I can publish messages to the topic /hooray/a/b and I see messages flow to my simple consumer. But they come through via a "Topic Endpoint". This is bad because I want a durable subscription. If my consumer node app is down and I publish messages they are lost to the consumer.

How can I open an AMQP 1.0 receiver that will bind to a topic and create (if it doesn't exist) a durable queue like I can with Rabbit?

Thanks for the help :)

Comments

  • dreamoka
    dreamoka Member Posts: 56 ✭✭✭

    do you have solution for this?

  • theironcook
    theironcook Member Posts: 4

    I eventually just used the Solace SMF library and it worked quite well

    But it did take a few hours to figure it out. Here are a few relevant pieces of code:

    consumer.on(solace.MessageConsumerEventName.UP, function () {

    consumer.addSubscription(new solace.Destination('workflowtriggers/*/*', 'topic'));

    consumer.addSubscription(new solace.Destination('somethingelse/*/*', 'topic'));

    consumer.addSubscription(new solace.Destination('iwuzlast/*/*', 'topic'));

    consumer.addSubscription(new solace.Destination('surveyId=123435', 'topic'));

    });

    consumer.on(solace.MessageConsumerEventName.MESSAGE, function (message) {

    console.log('>>>>MessageConsumerEventName.MESSAGE.', message.getBinaryAttachment());

    //console.log(message.dump());

    // Need to explicitly ack otherwise it will not be deleted from the message router

    message.acknowledge();

    });


    consumer.connect();

    consumer.start();


    The call to start() took a long time to figure out - not really documented well IMHO

  • himanshu
    himanshu Member, Employee Posts: 67 Solace Employee

    Hi @theironcook ,

    Hope you were able to figure it out. We have samples available here that can help you out further:

    If there is anything else you are looking to learn more about, let us know.