aspose file tools*
The moose likes Websphere and the fly likes Alert mechanism when Message Listener is down on Websphere Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "Alert mechanism when Message Listener is down on Websphere" Watch "Alert mechanism when Message Listener is down on Websphere" New topic
Author

Alert mechanism when Message Listener is down on Websphere

Deepak Shastri
Greenhorn

Joined: Aug 18, 2004
Posts: 22
Hi guys,
We know that when a poison message being rolled back from an Application (MDB) to the queue, keeps being re-delivered. As part of the configuration in the Message listeners...Max number of retries...Message Listener will keep redelivering the message to MDB. Once it reaches the equal to the backout count of the message, the Message Listener will go down i.e. stop.
So now no more messages will be delivered to that MDB listening against that listener..unless the message listener is started again (i.e. manually)
My question is the following:-

Is it possible to know automatically i.e. reading on a port or file in Websphere that a Message Listener is down ? This is important since in production environment we have quite a few applications and the listener goes down so silently, that unless the Business users complain of a problem we dont know that there is a manual restart required for the message listener. I would like to monitor this messsage listener. Please advise.


Thanks in Advance.
Roland Barcia
author
Ranch Hand

Joined: Apr 15, 2004
Posts: 181
In production, you would use WebSphere MQ as your provider (I hope). You would set the threshold less than the Message Listener Retry count. Thge threshold will forward the message to a dead letter queue.

Otherwise, if you are using Embedded Messaging, you can put logic in your MDB to read the message count and foward it to another queue.

You can also write a JMX program to restart the MessageListener


Roland Barcia: IBM Distinguished Engineer, CTO Mobile for Lab Services
Deepak Shastri
Greenhorn

Joined: Aug 18, 2004
Posts: 22
Hi Ronald,
Thanks for the reply. You are right, We are using Websphere MQ in Production.

But the problem is the following. I want to know that the listener has gone down. I understand how the threshhold and dead.letter queue and how it fits in the picture.
Problem we are having now that when the listener goes down, we have no way to get an alert (by atleast email) to the production support to start the listener again. Can you suggest a way ?
Roland Barcia
author
Ranch Hand

Joined: Apr 15, 2004
Posts: 181
Mostly every administrative object in WAS is a JMX MBean. The Listerer Port has an MBean as well. Some MBeans emit notifications when certain event happen. The WAS 5 Listener Port emmits j2ee.state.stopping and j2ee.state.stopped.

You can write a JMX notification Listener to be notified when these events get emitted from the Listener Port MBEan. When you receive the stop event, you can attempt to restart the Listener Port using JMX.

URL for writing event listeners:
http://www-128.ibm.com/developerworks/websphere/techjournal/0302_cundiff/cundiff.html

The tool MBeanInspector is a good tool to look at the MBeans in WAS. It will tell you what attribute, operations, and events an MBean has. It will also let you invoke them and create dummy event notifications to test out certain situations:
http://www.alphaworks.ibm.com/tech/mbeaninspector
Deepak Shastri
Greenhorn

Joined: Aug 18, 2004
Posts: 22
Thanks.

I have one more query to add, may be you can help.

When we deploy MDBs in a cluster (of 2 servers) is it true that the sequence of Messages can be lost ? Is there no way to control that unless 1st message is processed successfully only then 2nd message if processed by another server in the cluster. Currenltly we are using Websphere with MQ but I notice that in a single server when I test using 2 MDBs and 1 listener port the messages are being read out of sequence
Roland Barcia
author
Ranch Hand

Joined: Apr 15, 2004
Posts: 181
That is right. In general sequencing affects the overall scalability of an applicaiton. You have 2 things to consider. Queue clustering and Consumer clustering. In a fully highly available system, messages go through a clustered queue, whihc means sequences messages can get routed to different queues. Furthermore, you can have a cluster of MDB's on a particular queue competeing to read the messages. You have to configure a single pipe for sequenced messages.

Another alternative is to have the consumers share a common database. You cna store message pieces and reconstruct it when all the pieces arrive.
Deepak Shastri
Greenhorn

Joined: Aug 18, 2004
Posts: 22
Hi Ronald, I really appreciate your answers. Its helping me understand lot of things internally.
You mentioned creating a single pipe for clustered consumers (i.e. multiple MDBs on a cluster) how to achieve this single pipe fundamental..is it a configuration to be done within Websphere or MQ, can you put more light into this ?


Thanks
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30764
    
156

"Fiveday week",
We're pleased to have you here with us in the WebSphere forum, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks,
Jeanne
Forum Bartender


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Deepak Shastri
Greenhorn

Joined: Aug 18, 2004
Posts: 22
Hi,
I have updated it .

Thanks,
Deepak Shastri
Greenhorn

Joined: Aug 18, 2004
Posts: 22
My query got lost above....can you help me solve this puzzle on Clustered MDBs... I am pasting this question again.
-------------------------------------------------------------------------
Hi Ronald, I really appreciate your answers. Its helping me understand lot of things internally.
You mentioned creating a single pipe for clustered consumers (i.e. multiple MDBs on a cluster) how to achieve this single pipe fundamental..is it a configuration to be done within Websphere or MQ, can you put more light into this ?


Thanks
Roland Barcia
author
Ranch Hand

Joined: Apr 15, 2004
Posts: 181
By not using clustered queues and setting the Session Count for the listener port to 1.
Deepak Shastri
Greenhorn

Joined: Aug 18, 2004
Posts: 22
Hi Ronald,
In my case I dont have Clustered Queues (MQ Cluster)

But we have a Websphere Cluster with 2 servers. I have deployed an EAR containing an MDB and sesson bean on both the servers.

Each server has a listener port configured against the same queue. That means 2 listners ports against 1 queue. Now I want to restrict usage that unless MDB on Server-1 (in cluster-C) is finished processing a message (i.e. onmessage completes only then MDB on Server-2 (in cluster-C) should start processing 2nd message in the queue.

Is it possible, if yes how.
The max sessions does not work for me. Even if it does theoretically I believe in a cluster of 2 servers having 2 listener ports, it will not help.

Can you explain or help me with my quest ?

Thanks in advance
Wim Praet
Greenhorn

Joined: Jan 14, 2005
Posts: 5
Originally posted by Roland Barcia:
Mostly every administrative object in WAS is a JMX MBean. The Listerer Port has an MBean as well. Some MBeans emit notifications when certain event happen. The WAS 5 Listener Port emmits j2ee.state.stopping and j2ee.state.stopped.

You can write a JMX notification Listener to be notified when these events get emitted from the Listener Port MBEan. When you receive the stop event, you can attempt to restart the Listener Port using JMX.

URL for writing event listeners:
http://www-128.ibm.com/developerworks/websphere/techjournal/0302_cundiff/cundiff.html

The tool MBeanInspector is a good tool to look at the MBeans in WAS. It will tell you what attribute, operations, and events an MBean has. It will also let you invoke them and create dummy event notifications to test out certain situations:
http://www.alphaworks.ibm.com/tech/mbeaninspector


Roland, I implemented a NotificationListener according to the sample specified on the above URL, but notifications don't seem to arrive at my listener. Below is the code I use to add the notification listener:



Still, when I start or stop the ListenerPort using the admin console, I don't get an event in my listener. Neither does the notification log in the MBeanInspector tool show any events when I enable a notification listener for the ListenerPort.

What am I doing wrong?
Do I need to set the listener on a higher level? Do I need to enable something? Could it be that the events are eaten somewhere else?

Thanks for your help,
Wim.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Alert mechanism when Message Listener is down on Websphere