noodlefrenzy / node-amqp10

amqp10 is a promise-based, AMQP 1.0 compliant node.js client
MIT License
134 stars 56 forks source link

Beginners Question #325

Open KristianRaue opened 7 years ago

KristianRaue commented 7 years ago

Sorry, if this is far too basic, but I can't find any information anywhere for the following task. I get the basic samples to run, but not farther than that.

I would be great if somebody could provide a simple node-amqp10 code sample that shows to beginners how to publish to a qpid c++ message broker (with enabled AMQP 1.0 support) to a topic exchange that dynamically creates a durable queue and is using/creating a dot-seperated routing key (subject) in the newly created queue.

mbroadst commented 7 years ago

@KristianRaue AMQP 1.0 itself provides no explicit means to create links. Some do implicitly (ActiveMQ will just make the thing if you send to it iirc), some allow it explicitly (qpid lets you define a dynamic argument when creating the link from the client side, example), but its not part of the spec itself.

As far as examples, I'm unsure what further example you need. If you need complete end-to-end setup examples then you simply have to look no further than our integration tests: in the case of QPID we literally install the packages for qpid, create links, and then run tests against those defined links using the module - isn't that exactly what you're asking for here?

KristianRaue commented 7 years ago

Matt,

Thank you for the quick reply! I guess I am just looking for a hint on what to put in the {???}-Part of the following line of code.

client.createSender(queueName, {???})

if the queue (or exchange) does not yet exist on the Qpid c++ broker. And I want to make the new queue durable.

I understand that AMQP 1.0 does not care about broker context, but somehow the Qpid specific policy overrides should do the job by supplying some parameter here. I can't just find any docu on how to do it. Again sorry, if this seems like a stupid question.

mbroadst commented 7 years ago

@KristianRaue outside of creating a dynamic link (e.g. { attach: { source: { dynamic: true } } }), it's not possible with attributes to do what you want. QPIDs solution for this is using --topic-patterns and --queue-patterns options for qpidd, that allow you to specify patterns where dynamically created links are OK. Additionally you could attempt to use the qpid management framework to create links, I made a somewhat incomplete module for this a while ago over here.

This is not something we can provide "out of the box" in a qpid policy, this is specific to the broker's choices about configuration. I urge you to reach out on the qpid-users mailing list for more advice on this.