• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JMS timed redelivery

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Java Buzz
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
BTW, welcome to Javaranch. Please change your name to abide by the Naming Policy at Javaranch
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Java Buzz
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

In my case, I need to design some thing on my own to implement the same.



Other than the one which i mentioned in my first reply, nothing comes to mind, which can help you in this requirement.
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Java Buzz
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jaikiran,
This seems to be more viable solution. I will try this and will post if I face any issue in this approach.

Thanks !

~Hari
reply
    Bookmark Topic Watch Topic
  • New Topic