1 Reply Latest reply on Nov 10, 2003 10:32 PM by benstarr

    Scheduler/MBean Sending Message to Queue

    benstarr Newbie

      I have a message-driven bean that I would like to send messages to periodically (e.g. once a day) throughout the time that the JBoss server is running. Each time it receives a message it will rebuild a cache of information within the application.

      The only options I can think of to do this are to either create a Java client to run continuously and send message to the relevant queue or perhaps to use the Scheduler provided with JBoss. I would rather not use the former option since it will have to reside outside of the server and I'll have to create a way to start and stop it and it won't automatically start and stop with the server. Therefore I am wondering if it is possible to create a Scheduler that sends a message to a queue and if so whether this is a good idea (i.e. will it break/interfere with anything in JBoss or the EJB container)?

      I have read some other posts in this forum saying that it is possible to create a Scheduler with an MBean to call a method on an EJB but have not seen any examples of how to do it. Would I need to create a Scheduler that invokes an MBean that depends on the naming service and then looks up a Queue in the naming service and sends a message to it periodically? The main thing I am unclear about is how I would lookup the Queue in the naming service. Could I just access the initial context? Presumably I would be interrogating the naming service directly rather than using a logical name for the Queue? I don't quite understand what view I would have of the naming service since the code would be outside of any container.

      Any help would be greatly appreciated.