Wednesday, January 22, 2014

Publish/subscribe using the WebSphere MQ bridge for HTTP

WebSphere® MQ bridge for HTTP uses the WebSphere MQ classes for JMS publish/subscribe interface. HTTPPOST creates a publication. HTTP DELETE creates a non-durable managed subscription. You must configure publish/subscribe for JMS before using the topic URI.
Publish/subscribe is fully integrated into WebSphere MQ in version 7. Before version 7, a separate publish/subscribe broker handled publications and subscriptions. It is called "queued" publish/subscribe, to distinguish it from the fully integrated publish/subscribe in version 7. Version 7 emulates queued publish subscribe using integrated publish/subscribe. The emulation enables existing queued publish/subscribe applications to coexist with integrated applications running on the same queue manager. Queued publish/subscribe applications can also interoperate with integrated applications, sharing the same topics. In version 6, the broker was shipped with WebSphere MQ; before version 6 it was available as a SupportPack.

Configuration

The WebSphere MQ bridge for HTTP uses the JMS interface to publish and subscribe. In version 7, you can control whether the WebSphere MQ classes for JMS use queued or integrated publish/subscribe, using thePROVIDERVERSION JMS property.
An additional consideration is that you can use either WebSphere MQ client libraries with WebSphere MQ bridge for HTTP, or server libraries. Version 6 client libraries only support queued publish/subscribe, whereas version 7 libraries support both queued and integrated publish/subscribe. Most Web or application servers that use WebSphere MQ as a messaging provider do so using client libraries. In order to use integrated publish/subscribe, both the WebSphere MQ client and server libraries must be at least at version 7. If either is running an earlier version of WebSphere than 7, then you must configure queued publish/subscribe; see Table 1. Check what libraries are installed or configured with the Web server or application server you are using.
Table 1. Publish/subscribe configuration modes
Client V6 or earlierClient V7 or later
Server V6 or earlier
  1. Run the\java\bin\MQJMS_PSQ.mqscscript
Not supported
Server V7 or later
  1. Run the\java\bin\MQJMS_PSQ.mqscscript
  2. Set the queue manager toPSMODE=ENABLED
  1. If PROVIDERVERSION = 7
    1. Set the queue manager toPSMODE=ENABLED or PSMODE=COMPAT
  2. If PROVIDERVERSION = 6
    1. Set the queue manager toPSMODE=ENABLED

Publish

Send an HTTP POST request with the URI:
http://hostname:port/context_root/msg/topic/topicString
The message contents are published using the topic string topicString.

Subscribe

Send an HTTP DELETE request with the URI:
http://hostname:port/context_root/msg/topic/topicString
WebSphere MQ bridge for HTTP creates a managed non-durable subscription to the topic string topicString. The subscription is deleted as soon as a publication is returned, or until the wait-interval set by the custom entity-header, x-msg-wait, expires.

No comments: