Advanced Troubleshooting - WSO2 Message Broker

WSO2 Message Broker is designed to address,

1. to support large messages (up to about 10 MB)
2. to support speed message publishing and message receiving
3. to support scaling, with broker clustering 
4. ability to store many messages on disk if no consumers available
5. high availability of messages in permanent store, immune to single-point-of-failure

According to above design requirements, Apache Cassandra is chosen to be the most appropriate product to be used as the permanent storage for WSO2 Message Broker.




WSO2 MB stores messages, i.e message IDs, message metadata and message content and other flags related to subscriptions and properties in Cassandra as Column Families. 

First you need a bit of understand on how WSO2 MB is designed. Please read the post on "WSO2 Message Broker - Internal Architecture"  first.

While data is written to Apache Cassandra, you can view what is actually there in Cassandra using "Cassandra cli tool".  This guide will be an help for somebody who tries to do an advanced troubleshooting on WSO2 MB.

WSO2 MB uses a keyspace called "QpidKeySpace" to write all its data.
There are various column families vivid data is written. For an example, we write incoming messages to global queue. There the column family will be "GlobalQueue".

You can get ColumnFamily names used for various purposes from this class in WSO2 MB source. 

This guide depicts how to use Cassandra-cli tool to view actual data at Cassandra. 

Navigate to /bin and run ./cassandra-cli (cassandra-cli.bat for windows)

  • Connect to a running Cassandra instance.  
connect 127.0.0.1/9160; 

  • Get authenticated to the keyspace.
use QpidKeySpace; 

  • List rows of a Column Family
for example, view message contents which will be like there will be a row for a message with buffer offset as column name and byes as column value. 

LIST MessageContent;

But be default, this will list only 100 rows. 

To list more define a limit

LIST MessageContent limit 10000; 

  • To list all columns of a given row
for example, if you want to see messages written to "global queue", global queue name will be the row key, message id will be name of a column under some "global queue". Content will be message metadata.

LIST GlobalQueue;
get the generated id for the row
then 
GET[Id_of_row];
will list all the columns

  • Information are not in human readable format. To get them in text format set following for the session
ASSUME MessageContent KEYS AS utf8;

basically in general, you can set following to the session.

ASSUME records KEYS AS utf8;
ASSUME records COMPARATOR AS utf8;
ASSUME records VALIDATOR AS utf8;

Then information will be displayed in a readable format.

For additional information refer following articles from Cassandra Team

Hasitha Hiranya

No comments:

Post a Comment

Instagram