How to Subscribe to an AMQP Queue using WS Eventing
- By Lahiru Gunathilake
- 15 Dec, 2010
- Applies to
- Configure WSO2 ESB
- Initiating Notification Endpoint
- Creating a client to send a sample message to Qpid
- Send the subscription Message
AMQP client - initiate the message flow by sending a sample message to Apache Qpid Java broker.
Apache Qpid Java broker - AMQP implementation, which act as the message broker.
WSO2 ESB - listening to a defined queue in Apache Qpid and pick the messages from Qpid when a new message arrived to the Queue.
WSO2 Event Source - Event Source, to handle subscriptions and notifications.
WSO2 Event Listener - Web Services hosted in simple Axis server which is listening to the Queue in Apache Qpid.
Configure WSO2 ESB
Ex: If a message hits in “PublicEventSource” sequence with Header Topic="QpidEventService" and if there is a subscription for this Topic, we will notify the subscribers Endpoint by sending the current message to the endpoint (If there are mediators, the message will go through them and the result will be sent to the notification endpoint), provided in subscription process. All the incoming messages from Apache Qpid are having their Queue name in a transport level property called JMS_DESTINATION and we need to pick that property and set it as the Header property with name as Topic. After successfully setting Header Topic, Event Source will filter the event based on the subscriptions and send the notifications.
To get a better understanding about WSO2 Eventing implementation, please read this article.
As I have explained in the step above, we need to pick a property from the incoming JMS message and set the Queue Name to Header property Topic, so that the “PublicEventSource” configuration will look like this.
Initiating Notification Endpoint
Creating a client to send a sample message to Qpid
Send the subscription Message
Author: Lahiru Gunathilaka, Senior Software Engineer, WSO2 Inc