Using handles to home interfaces in a distributed environment


EJB design: Using handles to home interfaces in a distributed environment

  1. Problem: I am working on an administration product which will operate on multiple instances of another product. My interface to the other product instances is through an EJB layer. There can be any number of instances of the other product and they can be added and removed at any point during runtime. My administration application has to be able to interact with any of the instances. My administration application consists of two pieces: a web front-end where admistrators will control the operations, and an EJB layer that includes message, session, and entity beans and that will coordinate operations either on a single instance of the secondary application, or between two or more instances of the secondary application. Part of my requirements also state that administrators should be able to define actions that can be scheduled to run at specific times.

    If instances of the secondary application can be added, created, or removed at any time during the runtime of my administration application, how can I design the application so that my EJB components can accept and work with these secondary application instances without having to take my EJBs down and continually edit and maintain the resource references to remote EJBs?

    My theory is that I could define the remote references in the web application as the web application will need to interact some with these other application instances for query purposes. Instead of defining references to each of the secondary application instances in each of my EJBs, I could persist and use handles to the home interfaces for the secondary application's EJB layer that my administration EJBs can retrieve and use.

    My administration EJBs may exist on a separate VM than the web application, and the administration EJBs may exist on a separate VM than the secondary application EJBs.

    Can anyone validate whether this might work, or are there any other suggestions for this problem that I'm not thinking of?


  2. I forgot to state that I am working in a WebSphere environment, possibly with clusters as well.
  3. hi there... i tried to do some *callback* thing but it just gives me more headache.

    have you try to use JMS / MDBean to solve the problem?
    you can have any event notifications to be sent to an existing JMS topic / queue which a MDBean is listening to.

    i found out using XML to format as a text-message in JMS is more useful and more flexible. There are a bunch of exisiting Java Object / XML mapping tool, such as Castor ( You can try to create some VO object as place holder to hold the information, translated into an XML, and send through it to an JMS topic. Then in the MDBean you can get the VO back by mapping to the XML string in the message.

    This is more efficient. I don't think the *Observer* pattern in EJB will give your more flexibility as JMS.