Documentation for publish/consume?


My understanding of the Nameko is still basic. So please forgive and guide me if my statements sound incorrect. I do love Nameko for what it does in the RPC/Event world but I found it a bit limiting when it comes to real decoupling (which is what I why chose Microservices architecture). I have RPC in which I do need to know the “client” service (which is fair enough) and in Pub-Sub event example - I need to know the Producer service.

I really do the love the “topic exchange” in RabbitMQ where I worry not about the source but type of messages. Specially the usage of wildcard to get the right kind. How can I have that flexibility in Nameko ? Or how can I read messages created by non-Nameko services ?

After a lot of search - I found Publish/Consume in this forum which might be useful for me. Is there a documentation for this Publish/Consume ? I found that the documentation in has zero mention of this. Is that by design or just that the documentation is lagging far behind the code ? Is there a more detailed documentation of different other hidden gems ?

Can someone please guide if there is a more detailed documentation somewhere other than the above ? I know that I am just being lazy about reading the code in github to get a better understanding but I was hoping that I could just use it without opening the hood too wide.

Thanks and Regards,

Hey Shirish,

You’re right that the official docs currently have no mention of the lower-level Publish/Consume AMQP extensions, even though they’ve been part of the library from the very beginning. Nameko Events are in fact just a thin abstraction on top of Publish/Consume.

The best reference at the moment is the code. Both Publish and Consume live in the messaging module.

Their API is not very complicated:

The Publisher DependencyProvider accepts a kombu Exchange object, and the @consume entrypoint accepts a kombu Queue object. They will be declared on the broker at publish- or consume-time if they don’t already exist.

You can configure all sorts of AMQP messaging paradigms using these two objects, including topic/wildcard routing.

The reason it hasn’t been documented is partly because it’s a “lower level” API and partly because I don’t love the idea of passing kombu objects around. I think it would be preferable if you could specify queue bindings and so on directly with the Nameko extensions and have them pass through to the AMQP library transparently, rather than forcing users to understand the Nameko API and the Kombu API.

Hope that helps. Feel free to ask here if you have specific questions.

1 Like