cancel
Showing results for 
Search instead for 
Did you mean: 

Netweaver JMS issues

Former Member
0 Kudos

I have a stand alone enterprise java application (not an EJB) that currently runs on several servers (one application per server). This application allows us to do parellel processing for performance reasons. Another important distinction is that we use a JMS Point-to-Point model with multiple consumers receiving messages off a single queue. The application is basically a JMS asynchronous message consumer, meaning it implements the javax.jms.MessageListener interface so it has the onMessage method.

Currently I have been using JBoss 4.0 as our JMS Provider. I have had no issues for awhile now with multiple consumers receiving messages off a single queue. Recently, I have been asked to move to use Netweaver's JMS provider. I was successful in changing the configurations and sending and receiving messages using the Netweaver JMS provider. However, it appears that I cannot get multiple consumers to receive messages off a single queue. I can successfully launch off several of our applications on several servers all listening to the single queue and I can also put multiple messages into that single queue. However, it appears that only one message consumer can receive a message off the single queue at one time (all the other message consumers seem to wait until the one message is done processing).

Again, I changed the configurations back to JBoss and everything worked fine (I also did it for OpenJMS and it worked as well). My quess is that I either did not setup something correctly or I need to make some kind of administative or jms setting. Any help would be greatly appreciated.

Just a side note. If I poll for messages on the single queue instead of using the onMessage() method with multiple message consumers I am able to run parellel processes.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Michael,

That feature PTP and multiple consumers is not covered by the JMS and J2EE specs. It's vendor specific. However looking at your post you want to use it as a round-robin and load balancing, which should be possible with Netweaver JMS.

It's strange that you can achieve the code by synchronous consumers but not by message listeners.

Please check if you are keeping the references to your MessageListeners, it could be that they are lost, the objects are garbage collected and nobody is able to receive the message. Some other servers could be more tolerant with this use case.

Btw, a pure J2EE solution not using many receivers on a queue and depending on provider implementation, would be to use a topic and you subscribe by usage of appropriate selectors with unique Id-s.

Then you load balance while sending the message by putting appopriate property in the message. Just to mention it.

HTH

Peter

Former Member
0 Kudos

We are talking P2P with load balancing and scaling for throughput. Moving this to a pub/sub is a bad performance move as typically pub/sub is more time and resource intensive than P2P.

Just make sure that in your JNDI definition your queue has been marked as shareable. As the JMS spec goes it does not help if the provider side of the queue has the queue marked as not shared. As well if the app reading from the queue through the listener has it opened in exclusive mode all the others are waiting.

This means some investigation may be needed.

A) JNDI verify JMSDestination is defined as shareable

b) programming wise verify that putting the listener to the queue does not make the mode opened as exclusive.

Typically you would have implemented an MDB. You need to check the number of instances that you have defined for the MDB. As well you may define the same destination with multiple JNDI names and thus set different MDBs on the same queue (but same MDB class).

There is a world of solutions out there. Pick the one that works for you

Enjoy

Message was edited by: F.J. Brandelik

SAP's implementation of JMS persistence is through a Database. Make sure locking happens at the record level and not at the page level.

Answers (1)

Answers (1)

0 Kudos

Hi Mike,

Having multiple receivers on a queue is a feature that is not covered by the JMS specification, so it is completely vendor-dependent.

The SAP JMS Provider allows by default multiple queue consumers and serves them in a round-robin fashion.

Every consumer (no matter if it is synchronous or asynchronous) has a message buffer (client-side in-memory cache), in which messages for the respective consumer are prefetched from the server. There is one thread per destination on the server, which is delivering the messages to the client buffers. If you have several consumers registered to one and the same queue, the messages will be delivered to the buffer of each consumer sequentially, in a round robin cycle. So the message delivery from server to client is always sequential in this respect. If the consumers are slow enough (so that they always get the next message from their local buffer rather than from the server), from their point of view message delivery is parallel.

So you are right in your observation. But it is not like “locking the queue until the message is completely processed”, it is blocking the consumer until a new message is delivered for it in the round-robin sequence. If there is a very slow consumer which takes much time processing its message, this will not block the next consumer in the round-robin to receive the next message.

Greetings,

Stoyan

Former Member
0 Kudos

Thanks for the information. It was my observation that the SAP JMS provider does handle the messages in a round robin fashion that just confirms my observations. I can make a work around in my application in order to deal with this issue.