2 Replies Latest reply on Jul 25, 2006 6:39 PM by Ronald van Kuijk

    Remote accessible MBean

    Maciej Andreas Bednarz Newbie

      Hi there,

      I have noticed that there is no ready to use given way from within the project to remotly access an jBPM instance. I would suggest that someone (me) implements such a mbean. This way users could access jBPM instances by an jndi service locator which is remote accessible. What is the optinion about this? Is this worthy or has someone any oter kind of solution. As far as I can see an other way would be to expose the jBPM working instance by custom proxies like statefull session beans.


      A way to deploy such a MBean would be:

       <!-- jBPM Service -->
       <mbean code="org.jbpm.db.jmx.JbpmRemoteService"
       name="jboss.jbpm:name=DefaultJbpm,service=JbpmRemoteService"
       description="Default jBPM Service">
       <attribute name="JndiName">java:/jbpm/JbpmRemoteService</attribute>
       <depends>jboss:service=Naming</depends>
       <depends>jboss.jca:service=DataSourceBinding,name=JbpmDS</depends>
       </mbean>
      
       <!-- jBPM Service RMI Connector Proxy-->
       <mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"
       name="jboss.jmx:type=adaptor,name=JbpmRemoteServiceTarget,protocol=jrmp,service=proxyFactory">
      
       <!-- Use the standard JRMPInvoker -->
       <depends optional-attribute-name="InvokerName">
       jboss:service=invoker,type=jrmp
       </depends>
      
       <!-- The target MBean -->
       <depends optional-attribute-name="TargetName">
       jboss.jbpm:name=DefaultJbpm,service=JbpmRemoteService
       </depends>
      
       <!-- Where to bind the proxy factory -->
       <attribute name="JndiName">JbpmRemoteServiceTarget</attribute>
      
       <!-- Invoke target method instead of invoke(Invocation mi) -->
       <attribute name="InvokeTargetMethod">true</attribute>
      
       <!-- Comma-separated list of exported interfaces -->
       <attribute name="ExportedInterfaces">
       org.jbpm.db.jmx.JbpmRemoteServiceMBean
       </attribute>
      
       <!-- client-side interceptors -->
       <attribute name="ClientInterceptors">
       <interceptors>
       <interceptor>
       org.jboss.proxy.ClientMethodInterceptor
       </interceptor>
       <interceptor>
       org.jboss.proxy.SecurityInterceptor
       </interceptor>
       <interceptor>
       org.jboss.jmx.connector.invoker.client.InvokerAdaptorClientInterceptor
       </interceptor>
       <interceptor>
       org.jboss.invocation.InvokerInterceptor
       </interceptor>
       </interceptors>
       </attribute>
      
       </mbean>
      


      Accessing such a remotly exposed service would be as easy as:

      Hashtable<String, String> env = new Hashtable<String, String>();
       env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
       env.put(Context.PROVIDER_URL,"jnp://localhost");
      
      InitialContext ic = new InitialContext(env);
      
      JbpmRemoteServiceMBean service = (JbpmRemoteServiceMBean)ic.lookup("JbpmRemoteServiceTarget");
      


      Giving my best,

      M.A. Bednarz
      Germany, Hannover
      http://www.literadix.de