Skip to main content
Jump to: navigation, search

Stardust/Knowledge Base/Integration/Application/EJB/EJB Remote Client

Introduction

This article provides information on settings required for an EJB client (Remote) for invoking the Stardust Services (WorkflowService, AdministrationService,UserService, etc). Example below is based on the JBoss environment.

The EJB client project is a Simple java Project with following artifacts and settings:

Libraries

Make sure you have following libraries in the project classpath:

  • log4j-*.jar
  • jboss-client*.jar
  • carnot-base-*.jar
  • carnot-ejb3-*.jar
  • carnot-engine-*.jar

Properties

Attached here are sample properties.

Create a jboss-ejb-client.properties in the project classpath and have following entries

  • remote.connection.default.host = localhost
  • remote.connection.default.port = 4447
  • remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false

Edit the carnot.properties from the project class path and make sure it has following entries

  • Client.ServiceFactory = org.eclipse.stardust.engine.api.ejb3.RemoteServiceFactory
  • WorkflowService.JndiName = ejb:carnot/carnot-ejb3/WorkflowServiceImpl!org.eclipse.stardust.engine.api.ejb3.beans.RemoteWorkflowService
  • AdministrationService.JndiName = ejb:carnot/carnot-ejb3/AdministrationServiceImpl!org.eclipse.stardust.engine.api.ejb3.beans.RemoteAdministrationService
  • UserService.JndiName = ejb:carnot/carnot-ejb3/UserServiceImpl!org.eclipse.stardust.engine.api.ejb3.beans.RemoteUserService
  • QueryService.JndiName = ejb:carnot/carnot-ejb3/QueryServiceImpl!org.eclipse.stardust.engine.api.ejb3.beans.RemoteQueryService
  • DocumentManagementService.JndiName = ejb:carnot/carnot-ejb3/DocumentManagementServiceImpl!org.eclipse.stardust.engine.api.ejb3.beans.RemoteDocumentManagementService

For Weblogic and Websphere following Context Factories need to be specified:

  • WAS: com.ibm.websphere.naming.WsnInitialContextFactory
  • WEBLOGIC: weblogic.jndi.WLInitialContextFactory

  • JNDI.InitialContextFactory = org.jboss.naming.remote.client.InitialContextFactory
  • JNDI.URL = remote://localhost:4447 (JBOSS port)
  • JNDI.PackagePrefixes = org.jboss.ejb.client.naming

Sample Java Code

Any Service API call or customized Entity Bean can be invoked once you have the Remote EJB handle:

Client Log output:

12:13:14 INFO [main ] remoting - JBoss Remoting version 3.2.18.GA-redhat-1
12:13:14 INFO [main ] client - JBoss EJB Client version 1.0.24.Final-redhat-1
12:13:15 INFO [nt" task-1] remoting - EJBCLIENT000017: Received server version 2 and marshalling strategies [river]
12:13:15 INFO [main ] remoting - EJBCLIENT000013: Successful version handshake completed for receiver context
EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@6c166263, receiver=Remoting connection EJB receiver [connection=org.jboss.ejb.client.remoting.ConnectionPool$PooledConnection@31958905,channel=jboss.ejb,nodename=ap-pun-lp3039]} on channel Channel ID c01107ce (outbound) of Remoting connection 061d44c3 to localhost/127.0.0.1:4447

                  ServiceFactory sf = getTestService("default",null,null,"motu","motu");
			System.out.println("Service Factory****************" + sf);
			QueryService qs = sf.getQueryService();
 
 
			ProcessInstanceQuery piQuery = ProcessInstanceQuery.findAlive();
			ProcessInstances pis = qs.getAllProcessInstances(piQuery);
 
                   for (Iterator iterator = pis.iterator(); iterator.hasNext();) {
                        ProcessInstance pi = (ProcessInstance) iterator.next();
                        //log.info("PI: " + pi.getOID());
			System.out.println("Number of Process Definitions" + qs.getAllProcessDefinitions());
                   }

Back to the top