Task to start automaticaly triggered with some event


EJB design: Task to start automaticaly triggered with some event

  1. The Problem: Suppose I have an Online-Auction application built with one Servlet and EJBs. Each aucition has some duration time. I need my app. to check automatically (without any user or client request) if the auction is still running. As it belongs to "business logik", it schould not probably be the task of servlet. But without threads or timer (wihich is thread-based nad therefore prohibited in EJB, as far as I know) I see no possibility to do it in my EJBs. Any suggestions? Is there some server-based way to invoke an EJB method regulary and automaticaly? Can I communicate with this server to say him when it should do so?
  2. There is nothing stopping you writing autonomous services inside WebLogic, or any other app server, that do these things. Just remember that autonomous services running can interfere with the contain managing the resources of the server a little bit. If you just periodically check "is condition X still true" then you should be fine.


  3. Even I'm trying to achieve the same thing. I'm using Silverstream application server. In this app server, we have something called Business objects. If I use Scheduled Business Object, it works fine. But it is very much specific to Silverstream server and BusinessObjects doesn't come under J2EE technology. So it is purely vendor specific.
    I want to know, do we have any J2EE component which gets registered with any application server and triggers automatically when the timer reach the preset time? I'm trying hard to findout that. Please help me.
  4. You can use Flux. It's a complete job scheduling software component for J2EE and J2SE applications. It supports a wide variety of automatic, scheduled timing events, persistence, optional J2EE integration, etc, etc. Flux is database and application server independent.

    Flux can be found at www.simscomputing.com.

    Also, you can read a technical article about Job Scheduling here on The Server Side at http://www.theserverside.com/resources/jobj2ee.jsp.

  5. We are trying to do the same thing. It is clear how you can do it with external server "sending pulses" like flux.
    Problem is that it complicates the deployment as both a container & an independet server are required. It also doesn't seam to me as a "clean" approach to the problem.
    Is there a way to do it within the limits of the container?
  6. Hi Idan,

    Actually, with Flux neither a container nor an independent server is required. Flux is flexible so it can be placed in a simple "startup class" inside your app server. That way, for example, whenever you start WebLogic, Flux starts up too. It's very simple and clean that way.

    Other folks have embedded Flux in their servlets. That way, when a servlet comes to life, so does Flux.

    Flux is essentially just an object, not a heavyweight server. It can be easily configured to run inside the container. Deployment is actually quite simple and meshes tightly with the container/app server.

  7. Hi all. I can not hear about this Flux any more. It may be THE solution for all our problems and the BEST scheduler at all and so on. Each discussion about scheduling and EJBs MUST not contain the promotion from David Sims, i think! I have nothig against selfpromotion and Flux, but it wastes the time i spent to search about an idea how to MAKE it MYSELF, and not to BUY some commercial produkt. It would be very nice from someone, who is an expert in EJB and scheduling to help the community to solve this problem.
  8. The problem has been dealt with, a product was written. If you think you can write something that does the job as well then go ahead and try. I suspect not, for the simple reason that you have other things to do besides write this tool. The people who wrote Flux did not.

    It is precisely the job of this community to suggest ways to solve problems quickly, pragmatically and effectively. None of this presupposes that we must write things ourselves.

    To quote you:

    "It would be very nice from someone, who is an expert in EJB and scheduling to help the community to solve this problem."

    As has already been stated, EJB is not the way to do this. You can continue to restate the problem as often as you like until someone tells you some way to do it but that doesn't make it the right answer. :-)

    Flux is exactly the solution to your problem. If you want to write your own then it can still give you help. Look at the way it works when you start it, use it etc.