Hi, I am using JMS topic(websphere default JMS) to notify some consumers. The consumers have to process and push the data to other external systems. Sometimes the external systems might be down temoporarily, in which case I need to redeliver the message to the consumer.
Which is the most elegant way of implementing this. Regards, Hari
Sometimes the external systems might be down temoporarily
If your consumers are MDBs: Will the consumers be able to identify whether the external system is down? If yes you can call the setRollbackOnly method on the message driven context which will tell the server to redeliver the message.
In case your consumers are not MDBs, then you can use CLIENT_ACKNOWLEDGEMENT on the session which sends the messages(producer). And whenever the consumer finds the external system down he will send a failure acknowledgement which will tell the server to redeliver the message.
However the problem with both these approaches will be, you cannot tell the container after what interval the message should be redelivered. It might so happen that when the message is redelivered the external system might still be down.
Hi, The consumers are MDB's in my case. And regarding the retries I want to retry only three times max, with a time difference of 5 mins. So it is like after first attempts, rety attempts will be made at 5th, 10th and 15th min. If this is the requirement, then how can I go about? Regards, Hari
I want to retry only three times max, with a time difference of 5 mins.
I am sure you can specify the retry limit. However what i am not sure is whether you can specify the time difference between these retries. I have seen such a thing in JBoss but not aware about Websphere. You might have to check the Websphere documentation to see if its possible.
I checked the documentatin of both Websphere default JMS and the websphere MQ. Both of them doesn't seem to provide. Weblogic 9.2 offers. In my case, I need to design some thing on my own to implement the same.
I had been searching about this for the past 6 hours. There are so many "weird" implementations being suggested. But I am looking for a cleaner one.
*Note - The same question has been raised on some forum way back in 1999
On second thoughts, how about this (not so elegant) approach:
1) Your consumer(MDB) identifies that the external system is down 2) This MDB will schedule a job(which will start 5 min from now) using a Scheduler(there are open source schedulers like Quartz which you can use). The MDB will pass the message(which it received in its onMessage method) as a parameter to the scheduled job. 3) The onMessage method of this MDB will return normally, so that the message is removed from the queue and will NOT be redelivered.
Now after 5 minutes, the scheduled job is invoked and it receives the message as the parameter. The responsibility of this scheduled job will be to put the message back to the original queue so that it is delivered to the MDB by the server.
I cant say what all issues you might encounter while trying to get this working, since i haven't tried this sort of a thing myself. Also this does not look like a elegant solution to me - you can add this to those "weird" implementations, which you mention, you have already seen. I would rather prefer the application server providing me a feature like "redelivery interval" for redelivering the messages.