1 Reply Latest reply on Nov 29, 2006 3:15 AM by kaobe

    Setting up an Interceptor on jBoss

    haensel

      Hello,
      my name is Hans-Martin. I am a student from Germany.

      I have a very big problem. My Professor wants me to send events via JMS to a Complex Event Processing Platform.

      First of all my professor gave me the simple job to create a jsp with 4 Buttons. He wants to see ?something move??.

      The task is following:
      Every time a button is pushed it calls a Method on a Servlet/Bean. The Interceptor realizes this call and creates a simple ?Button_X-was-pushed? event (for example as a string) . This event will be sent via JMS to a CEP Platform which checks for patterns like ?Button_X was pushed? and updates a database which counts the pushes of a single Button.

      This database can be called by a simple page/dashboard to show the number of times a button was pushed.
      All that must be realized on jBoss.

      It is a pretty simple example but we have absolutely NO idea of jBoss, how I can plug in the interceptors or send JMS messages.

      What software do I need for this ? Do I need EJB3.0 for that task ?
      Do you know a tutorial for the installation/implementation/configuration ?

      I don´t even know how what project I have to create in jBoss IDE for eclipse.

      I created an jBossAOP Project. And it was pretty simple to connect an Interceptor to a method of another class. But I am not able to do this in a dynamic Web Project (for JSPs, Servlets and so on)


      PLEASE HELP ME. I have just 1 week to do this :(


      Haensel

        • 1. Re: Setting up an Interceptor on jBoss
          kaobe

          Hi Hans-Martin,

          maybe I'm not understanding your problem correctly, but here is what I would do:
          1. You have a jsp with a form that has an action that points to a servlet.
          2. In this servlet you are handling the request. You could have one servlet for each button or one servlet for all and then decide inside the servlet which button was the source of the click. In the servlet you call an EJB (Session Bean) with a method like "buttonPressed(ButtonDescription description)".
          3. This EJB calls a Message Driven Bean (the JMS component) that does the asynchronous communication. This is where I don't understand the task, because this action is simple and fast, so why does it have to be JMS and asynchronous?
          4. The MDB calls an EJB that saves the data in the database.

          The reason for the EJB -> MDB -> EJB is, that an MDB should be called from the business logic and should call business logic. Its only reason to exist is that is lets the first EJB return at once and not block the client.

          Another possibility is that your professor meant the Interceptor Chain of JBoss. Then you would have to implement a class that implements Interceptor (a JBoss class, you should look in the docu). This class does the save of the button click and is put in the interceptor chain of an EJB in server//conf/standardjboss.xml. But this makes no sense because the interceptor can not decide which button has been pressed and it is executed at every EJB-invocation, where the EJB has this invoker-proxy-binding.

          If I understood you wrong, you would have to clarify this a bit for me.

          Greetings,

          Peter