Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The purpose of this guide is to get you started on the main features of WSO2 Message Broker (MB) as quickly as possible. We will create a few create queues and topics on WSO2 MB and then see how a JMS client clients can be configured to operate as a publisher and subscribersend messages to these queues/topics and receive messages from them.

Table of Contents
maxLevel4
minLevel2

...

Key concepts

...

Explained below are some of the key elements and features in WSO2 MBconcepts in message brokering.

Table of Contents
maxLevel5
minLevel5
typeflat

...

Queues in WSO2 MB are essentially message stores , which that can store messages from external JMS clients (publishers) and maintain them in an intermediate state until they are consumed by other JMS clients (subscribers).

...

Topics in WSO2 MB are used for realtime message brokering. As depicted by the following diagram, you You can maintain a hierarchy of topics or subjects in WSO2 MB for which messages can be published by external JMS clients (publisherssubscribers) can subscribe. Other JMS clients (subscribers) can subscribe to the topics of interest and receive the messages published to the topic. publishers) can then publish messages to these topics, which will immediately be consumed by the subscribers.

Anchor
Sub and Pub
Sub and Pub
Subscribers and Publishers

A JMS client that is configured to send messages to a queue or topic is known as a publisher. A JMS client that is configured to receive messages published to a particular queue or topic is known as a subscriber.

Role-based permissions

The possibility to work with queues and topics in WSO2 MB is strictly secured by role-based permissions. That is, users created in WSO2 MB should be granted the required permissions in order to publish messages to queues/topics and to consume the messages that are published. External clients will then be able to use the credentials of these authorized users in order to send messages and consume messages.

Metrics monitoring

You can effectively monitor the performance and statistics of your WSO2 MB server using Java Metrics.

Management Console

The management console of WSO2 MB is the user interface of the product, which can be used to conveniently create topics and queues and to manage subscriptions. External clients can then connect to WSO2 MB for publishing messages and consuming already published messages.

...

Download sample JMS clients

WSO2 Message Broker is used for brokering messages between JMS clients. We will use the following sample JMS clients in this quick start guide to see how this process works.to simulate how messages are published to WSO2 MB and how the published messages are consumed. First, you need to download and set up these clients as follows:

  1. Click this link to download the QuickStartClients.zip file, which contains the following sample clients.
    • JMS queue publisher
    • JMS queue subscriber
    • JMS topic publisher
    • JMS topic subscriber
    • JMS durable topic subscriber
  2. Extract this file to a location on your computer. We will call this <JMS_CLIENTS_HOME> from hereon.

...

Let's try out a simple scenario of brokering messages using a queue in WSO2 MB.

Step 1: Create a queue in WSO2 MB

...

  1. Log in to the management console using the credentials of the default system administrator: admin/admin.
    You will now be logging into the super tenant domain. 
  2. In the Main tab, click Queues -> Add. The Add Queue screen will open.
  3. Enter 'testQueue' as the name in the Queue Name field as shown below.
    Image RemovedImage Added
  4. Click Add Queue and the new queue will be listed in the Queue List page as shown below.
    Image RemovedImage Added
    You can access the Queue List page by clicking Queues -> List in the Main tab of the navigator.

Step 2: Publish messages to the queue

You can now use the queue publisher sample JMS Queue Publisher client to publish messages to this queue. Follow the steps given below.

  1. Open a command prompt and navigate to the <JMS_CLIENTS_HOME> directory on your computer.
  2. Execute the following command, which will publish 10 messages to the queue named 'testQueue':

    Code Block
    ant queuePublisher
  3. Go to the management console.
  4. In the Main tab, click Queues -> List. You can see that 10 messages have been published to the queue as shown below.
    Image RemovedImage Added
  5. Click Browse to see details of the messages received.

Step 3: Subscribe to the queue and consume messages

The queue subscriber Now, you need a JMS client to subscribe to the 'testQueue' queue and consume the messages. The sample JMS Queue Subscriber JMS client will be used for this purpose. Follow the steps given below.

  1. Open a command a command prompt and navigate to the location of your JMS clientsthe <JMS_CLIENTS_HOME> directory on your computer.
  2. Execute the following command, which will subscribe to create a subscription to the queue and consume the available messages'testQueue' queue.

    Code Block
    ant queueSubscriber
  3. The 10 messages in the queue have been successfully consumed by the subscriber. You can verify this from the terminal log:
    Image Added
  4. Go to the management console . In the Main tab, and click Queues -> ListList in the Main tab. You can see that the 10 messages that were stored in the queue have been successfully consumed by the subscriber.You can verify this from the terminal log.
    Image Removedare no longer there.