Skip to Content

With all of the hype surrounding Web services these days, you don’t hear much about message-oriented middleware (MOM) anymore. This is a shame, because messaging solutions really do have a lot to offer in terms of reliability and scalability. But that’s another lesson for another day.

Assuming you’ve already bought into all that MOM has to offer, then you’re probably at least familiar with the Java™ Message Service (JMS) on some level. JMS is a vendor-neutral API that can be used to interact with messaging systems. As a Java™ developer, this means that you can write a piece of code to interact with IBM’s WebSphere MQ and then turn around and use that same piece of code to process messages on SAP’s JMS provider. This is analogous to the use of other generic APIs such as JDBC, JavaMail, and JNDI.

While the JMS API defines rich semantics for processing messages, it doesn’t have a lot to say about how to carry out certain administrative tasks. Frequently, these operations are performed using proprietary extensions and/or JMX MBeans. But what if you just want a simple administrative console to perform simple operations like browsing a queue, adding messages/removing messages, and so on?

Coming up with a solution for this has been something I’ve been playing around with off and on for quite some time. After giving the open-source HermesJMS tool an extended look, I ultimately decided that I needed something a little more specialized for what I was trying to accomplish. In this blog, I will present a custom Web Dynpro-based management tool that can be used to perform simple administrative tasks on the default SAP JMS provider.

The Solution

The solution was developed using Web Dynpro for Java on an SAP NetWeaver AS Java 7.1 stack. The core functionality is implemented exclusively using the JMS and JNDI APIs, so no proprietary extensions are required to install this solution. The following figure shows the main selection screen area where you can search for JMS queues that you wish to manage. The results table allows you to view messages, create sample messages, and remove messages.

image

Searching for Queues

If you can’t remember the name of the queue you want to manage, you can browse to it using the advanced search capabilities built into the tool. This search help lets you search for queues using regular expression syntax (see the figure below).

image

Creating Messages

You can click on the Create button to create a new message. Here, you will be prompted with an input mask that allows you to create a TextMessage. This could include a sample XML snippet, or some other text payload of your choosing. As the source code is provided, you could conceivably develop support for other message type as necessary.

image

Viewing Messages

You can view a JMS message by selecting it in the table and clicking on the View Message button. The figure below shows what the screen looks like. In addition to the JMS message ID and timestamp, you can also see custom header properties that were added to the message.

Viewing a JMS Message

Removing Messages

To remove a message, simply select it in the table and click on the Remove Message button. One thing to keep in mind here is that this function will only work if there are no registered listeners (e.g. MDBs, and so on) on the queue in question; otherwise the operation will fail. This is because JMS does not provide API methods for removing messages. Therefore, the only portable way of achieving this is to create an ad hoc consumer that uses message selectors to filter on the selected message IDs.

Purging the Queue

You can think of the Purge Queue button as a mass deletion operation that is designed to remove all messages from the queue. This function is also subject to the same constraints as the Remove Message function.

Security

As you can imagine, many of these operations are powerful and must be secured against novice users who could potentially wreak havoc on the system. To guard against this, a series of UME actions were defined to protect access to the more sensitive functions. The figure below shows the creation of a sample UME role called JMSAdministrator that contains these actions. You can mix and match these actions in different roles as needed.

image

Where can I go to get it?

The final solution is bundled as an SCA archive and available for download here. I hope that this will be of some use to you, and thanks for reading.

To report this post you need to login first.

8 Comments

You must be Logged on to comment or reply to a post.

  1. Trevor Naidoo
    An admin tool for SAP JMS queues from a SAP PI perspective is something is sorely missed by the SAP PI developers.

    I have an additional problem at a customer when trying to communicate between SAP PI & BEA Weblogic JMS queues. When the BEA server or queues go wonky it still retains the same context for all previously connected SAP JMS Adapters. What this means is that the SAP JMS adapters appear to have re-connected properly (green lights all round) to the BEA JMS queues but in actual fact they haven’t. It is a known issue on the BEA side with a SAP note issued for the fix but that fix doesn’t seem to work at this specific customer.

    So a manual re-start of the SAP JMS adapters has to done to get the adapters polling the BEA queues again but this is a rather re-active process which isn’t ideal for a messaging system that needs to be reliable. I was looking at crafting a similar server side tool but with the added flexibility of external queue monitoring & alerting, maybe creating workflows if messages in a specific queue exceed a certain threshold or something. Just haven’t got around to it yet. Maybe this tool can motivate me to get started 🙂

    (0) 
  2. M. Rabe
    Hi James,

    such a useful tool. And thanks for providing the sources.I was able to modify them to access our own queues in our own JMS providers and I’m not even a programmer. So many kudo’s to you.

    Marcel

    (0) 
  3. Sebastian Simon
    Very nice tool. Good work!

    I always wondered why SAP doesn’t recognize the gap about that (tools like this are quite common in other app servers….)

    Best wishes
               Sebastian

    (0) 
  4. Julien Huno

    Hi James,

    This seems very useful indeed!! But since it has been released in 2010, is this compliant with the latest version of SAP PO (7.4)?

    Did you perform any updates on it? Are you still using this add-on?

    Regards,

    Julien

    (0) 
    1. James Wood Post author

      Hi Julien,

      I haven’t deployed it on a 7.4 environment, but see no reason why you couldn’t. It’s a pretty basic tool utilizing core Java EE APIs to do the heavy lifting. Let me know if you have any issues, but I think you should be good to go.

      Thanks,

      James

      (0) 
      1. Julien Huno

        Thanks for your answer James!

        Indeed It works well on a 7.4 environment! I do not understand why this is not available by default…

        Still the tool seems not to be designed for topics because I can only find queues unless there is some special combination I did not get?

        Regards,

        Julien

        (0) 

Leave a Reply