Red Hat Bugzilla – Bug 461572
Simpler examples in the Tutorial
Last modified: 2016-05-22 19:27:36 EDT
Created attachment 316158 [details]
simple qpid client
The examples in the tutorial jumps to a pretty advanced level quite quickly. I would suggest to make also space for some really small and easy level examples as well, to get started and get familiar with the concept.
I've written a small program used for testing a bug, and this could most probably be modified and adjusted to fit into such an example.
When I compare your program to the first program in the tutorial, I think the main difference is that you use the default exchange, which saves a few lines of code, but actually not that many.
The advantage of the approach I currently take is that the code reflects the basic concepts people need to learn. So your program avoids these lines:
session.exchangeBind(arg::exchange="amq.direct", arg::queue="message_queue", arg::bindingKey="routing_key");
But these lines are central to understanding the relationship between exchanges, queues, and bindings. Your program uses the default exchange, so it does not need these lines, but the tutorial would still have to explain why the messages in your program somehow get delivered to the queue. I would have to explain the default exchange and the bindings it uses in the very first example, without any explicit syntax to point to.
You also save an argument in messageTransfer() by not specifying the exchange to which the message is sent, so it defaults to the default exchange. The first example in the tutorial specifies the direct exchange:
For reading from the queue, your program is *definitely* simpler. The current tutorial code starts with a message listener rather than SubscriptionManager.get() or perhaps a local queue. Modifying the first example to use one of these simpler methods might make sense, but I would still want to introduce listener.cpp as part of the initial direct example, because most of the time, we really do want people to read using either a message listener or a local queue.