2 Replies Latest reply on Sep 25, 2003 1:56 PM by malatorr

    java event model applied to EJB and client

    malatorr

      I'm trying to test the java event model (event source - event and listeners)

      My idea is to subscribe clients (as listener) to the ejb (as source) but I'm new with ejb and don't really know this is posible to do.

      First from the client I call:

      myEjb.addNumberChangeListener(this);

      then I call a method:

      myEjb.setNumber(3);

      this method (at the server) calls
      notifyAllListeners();

      And call the client method:
      onNumberChangeEvent(NumberChangeEvent e)

      But this examples crash on my session stateless ejb saying at runntime:
      RemoteException, end then "wrong number of parameters"

      This error appears when the addNumberChangeEventListener(this) is called.

      I need to know if can be implemented this on jboss.
      Thanks!
      Mariano

        • 1. Re: java event model applied to EJB and client

          First of All i'm not sure why would you do that, If you want to do something like that then there are well known patterns for diferent scenarios.
          Have a look at the MVC pattern.
          Where Model is data coming from EJBS, servlets are acting as listeners and JSP/HtML pages are view.
          Also in bigger application if you are using session facade pattern (stateless session bean) acts as a listener as well.

          If you want to look at these patterns we have implemented them in our recently published tutorial.

          www.tusc.com.au/tutorial/html/index.html
          MVC in chapter 8.
          Session Facade, chapter 5, 6, 7.

          Vishal.

          • 2. Re: java event model applied to EJB and client
            malatorr

            I have too many frame clients (awt) running on several machines and all I want is use beans to let the java events get any client.

            So all clients are updated about any change.

            I don't have servlets or web. Just standalone clients that reports events to a ejb, and the ejb must notify the rest about these events.

            I was reading about connectors and notifications. Can this technology help me?

            Mariano