Remote Java API
Using the Remote Java RuntimeEngine API
RemoteRestSessionFactory
or RemoteJmsSessionFactory
classes provided by the kie-services-client
jar, you can create remote instances of the RuntimeEngine
and thus also the KieSession
and TaskService
. These instances will allow you to interact with a remote workbench instance (i.e. KIE workbench or the jBPM Console) without having to deal with the underlying transport and serialization details.The REST Remote Java RuntimeEngine
RemoteRestSessionFactory
can be used. The following example illustrates how the remote session can be used.// Create REST session RemoteRestSessionFactory restSessionFactory = new RemoteRestSessionFactory(deploymentId, deploymentUrl, user, password); RuntimeEngine engine = restSessionFactory.newRuntimeEngine(); KieSession ksession = engine.getKieSession(); ProcessInstance processInstance = ksession.startProcess("org.jbpm.humantask"); TaskService taskService = engine.getTaskService(); List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner(taskUserId, "en-UK"); long taskId = findTaskId(processInstance.getId(), tasks); Task task = taskService.getTaskById(taskId); taskService.start(taskId, taskUserId); taskService.complete(taskId, taskUserId, null);In the above example, the following variables were used when initalizing the
RemoteRestSessionFactory
Pagination query parameter syntax
Variable | Possible value | Description |
---|---|---|
deploymentId | demoproject |
This is the name (id) of the deployment the
RuntimeEngine should interact with. |
deploymentURL | http://localhost:8080/kie-wb/ |
This is the base URL that should be used when interacting with the remote execution-server.
|
user | krisv | This is the user needed for authentication for all rest calls. |
password | pa$$w0rd |
This is the password for the user specified in the
user parameter. |
See the various constructors of the
RemoteRestSessionFactory
class for more possibilities.
No comments:
Post a Comment