5 Replies Latest reply on Feb 27, 2012 7:40 AM by jdabrowski

    Remote EJB - questions

    jdabrowski

      Hi,

       

      while testing new remote EJB invocations I get into some questions:

       

      1. In tutorial it is mentioned that "...For example, an EJB receiver "Foo" might be able to handle invocation on a bean identified by app-A/module-A/distinctinctName-A/Bar!RemoteBar, whereas a EJB receiver named "Blah" might be able to handle invocation on a bean identified by app-B/module-B/distinctName-B/BeanB!RemoteBean. Each such EJB receiver knows about what set of EJBs it can handle and each of the EJB receiver knows which server target to use for handling the invocations on the bean..."

       

      How to achive this? How to assign receiver (or receivers) to service (service name)?

       

      2. I have a client which invokes method on some server every 10 sek. If I undeploy application and deploy again I can still invoke method. But if I restart server I can't. Is it ok?

      I don't care if server was restarted (especially if it is stateless service).

      It would be nice if mechanism could restore connection.

       

      3. I need to maintain connection selection during invocation. I have two servers where one is a master and second is an emergency. I would like to send all invocations to first one and use second one only if first one if down. How can I achive this?

       

      All those questions are because I can't set actual connection to created proxy before invocation. Maybe it could be possible to have connection assigned to proxy, but if not then using settings from EJBClientContext?

        • 1. Re: Remote EJB - questions
          jaikiran

          Jacek Dabrowski wrote:

           


          1. In tutorial it is mentioned that "...For example, an EJB receiver "Foo" might be able to handle invocation on a bean identified by app-A/module-A/distinctinctName-A/Bar!RemoteBar, whereas a EJB receiver named "Blah" might be able to handle invocation on a bean identified by app-B/module-B/distinctName-B/BeanB!RemoteBean. Each such EJB receiver knows about what set of EJBs it can handle and each of the EJB receiver knows which server target to use for handling the invocations on the bean..."

           

          How to achive this? How to assign receiver (or receivers) to service (service name)?

          A remoting receiver is a remoting connection to the server. What this means is, if your receiver is configured for host = 10.20.30.40 and port = 4447, then that receiver will be able to handle invocations on the EJBs that are deployed on that server instance. When the EJB client connects (this is all internal implementation details, and not something the end user application does) to the server, the server sends back a deployment repository which is a collection of identifiers (appname, modulename, distinctname combination) of all the EJBs that are deployed on that server. So that remoting receiver now knows about the EJB identifiers, it can handle. Whenever the deployment is undeployed on the server, the server sends a undeploy notification to this remoting receiver to let it know that the deployment no longer exists. The receiver will then know that it can no longer handle the appname/modulename/distinctname combination.

           

           

          Jacek Dabrowski wrote:

           

          2. I have a client which invokes method on some server every 10 sek. If I undeploy application and deploy again I can still invoke method. But if I restart server I can't. Is it ok?

          I don't care if server was restarted (especially if it is stateless service).

          It would be nice if mechanism could restore connection.

           

          Re-connecting to a broken connection (like the server going down and coming back up) is not yet implemented. We do have plans to implement it in the upcoming versions. Right now, like you say, if the application is undeployed/redeployed, you'll still be able to invoke on the beans. But with server restart it won't be possible unless you restart your client application.

           

           

          Jacek Dabrowski wrote:

           

           

          3. I need to maintain connection selection during invocation. I have two servers where one is a master and second is an emergency. I would like to send all invocations to first one and use second one only if first one if down. How can I achive this?

           

          All those questions are because I can't set actual connection to created proxy before invocation. Maybe it could be possible to have connection assigned to proxy, but if not then using settings from EJBClientContext?

          The documentation that I posted is mainly for JNDI invocations which internally use the new EJB client API which is much more flexible and allows you a lot more control on how you setup your receivers. I'll be publishing that document in the coming days and will let you know once that's ready.

          • 2. Re: Remote EJB - questions
            jdabrowski

            How about JBoss 7.1? Is re-connecting implemented?

             

            And  about point 3 - could you post  link to  article (if already exists) about new EJB client API?

            • 3. Re: Remote EJB - questions
              prasad.deshpande

               

              How about JBoss 7.1? Is re-connecting implemented?

              No, 7.1.0.Final do not have this implemented, you can track progress here https://issues.jboss.org/browse/EJBCLIENT-26

              • 4. Re: Remote EJB - questions
                jaikiran

                Actually re-connection capability is indeed available in 7.1.0.Final. That specific JIRA https://issues.jboss.org/browse/EJBCLIENT-26 is for a specific case which got missed out. The re-connection works as follows in 7.1.0.Final:

                 

                1) Initial connections are created based on the client configuration of the EJB client context.

                2) Successful connections are added to the EJB client context as a EJB receivers

                3) Each of these successful connections have a reconnect handler which will be triggered to re-connect if that connection breaks.

                 

                See this for more details https://issues.jboss.org/browse/EJBCLIENT-21

                • 5. Re: Remote EJB - questions
                  jdabrowski

                  Once more:

                   

                  is new EJB client API documented somewhere? Is the API ready for use in 7.1?

                   

                  is it possible to prefere one server over another (point 3 in the first post) ?