Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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 ...
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Message driven bean with limited backend uptime

Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to create a interface to a service with a limited uptime.
In my case, the backend is only open say 9am-5pm.
If a request is received outside of these hours, queue the msg and work on it when the uptime window comes back.

So I thought a asynchronous approach with a JMS queue (point to point) would be good.
client -> work queue -> message bean (MDB)

But how do I solve the time aspect of the service?

I would like to use the JMS framework here, but can't use a message selector, because it only looks at the timestamp of the message, not the current time.

I've thought of three workarounds, but neither flies well, any tips here?

1. Control the message listener port to be up only 9-5.
We're using Webspher App Server, so I could script something that would turn off and on the listener port, via cron.

2. Use two queues: the client puts the message on a "stage queue", and a special message bean decides if the message was received during uptime,
if so, put it on the work queue where the regular message bean runs.
if not, don't acknowledge the message and keep retrying until the time window comes back.

3. The message bean itself knows what the uptime is and sleeps for 5 minutes before trying again. It keeps doing so until the uptime window is back.
If I have 10 MDB in the pool and 10 messages, 10 threads will just sit there in this wait loop.

[ March 21, 2005: Message edited by: Thomas Olausson ]
Thomas Olausson
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I love when I post something here and figure out the solution myself.
Solved it this way:

Websphere App Server has a scriptable interface to the Mbean server, via a command line tool called wsadmin.
So, to turn on and off a message listener port, one's gotta do this:

First, login to the mbean server with wsadmin

Stop the message listener port called "MyPort"

Start it:

Add a cron job that takes up and down the port, or script it with Quartz
[ March 22, 2005: Message edited by: Thomas Olausson ]
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic