Search code examples
ibm-cloudmessagingmq

How can I do point-to-point messaging in Bluemix using MQ Light?


I want to achieve point-to-point messaging in Bluemix using MQ Light.

Can I do this? I don't want to define topics, but rather have the MQ Light service be aware of the destination where the message needs to be sent.

I don't want to use the pub-sub model, instead I wish to have the messages directly delivered to the destined consumer node.js application.

How can I achieve this?


Solution

  • Although the addresses used by applications to send messages have a topic/pubsub style format, the MQ Light API supports the delivery of these messages in both the queue and pub/sub models. Further details for the concepts can be found here:

    https://developer.ibm.com/messaging/mq-light/docs/concepts/

    In summary, the style of message delivery (queued or pub/sub) is selected by the receiving application when it defines the destination it wants to receive messages from. If it specifies a 'shared destinaton' it will get queue style semantics, where each message at the destination will only be delivered to one of the applications which are receiving from that destination (e.g. who use the same shared destination). If it doesn't use a shared destination then it will receive its own copy of every message e.g. pub/sub. The sending application is the same in both cases.

    As an example. If an applications sends messages to the address '/address/Q1'

    If applications A, B and C all define to use a shared destination 'dest1' which is mapped to the address '/address/Q1' then any message sent to that address will be shared between them (a queue style delivery model), so only one of the apps will receive each message.

    If applications A, B and C all define to use a non-shared destination which is mapped to the address '/address/Q1' then any message sent to that address will be received by all the applications (a pub/sub style delivery model).

    In both cases the application can set the timeToLive for the destination to control the length of time that messages will be kept when the application is not connected. This again is commonly set differently between pub/sub and queue delivery models, but is easily controlled by the application.