[jboss-user] [jBPM] - Human Task Module SwitchYard Integration

Mauricio Salatino do-not-reply at jboss.com
Tue Jul 10 05:49:09 EDT 2012


Mauricio Salatino [https://community.jboss.org/people/salaboy21] modified the document:

"Human Task Module SwitchYard Integration"

To view the document, visit: https://community.jboss.org/docs/DOC-18719

--------------------------------------------------------------
After providing a well defined set of Interfaces from the Human Task Module the next step is to expose those interfaces as services.
Reference: 
 https://community.jboss.org/docs/DOC-18617 https://community.jboss.org/wiki/HumanTaskModuleRoadMap
 https://community.jboss.org/docs/DOC-18641 https://community.jboss.org/wiki/HumanTaskAPIAndDataStructuresProposal
Leveraging the power of CDI and its integration with frameworks like Switchyard, Camel and JMS I will be doing some experiments to integrate these technologies together.
The main focus of this experiments is to remove the need of handling any transport related code inside the Human Task Module. 
Providing Sync and Async integration points will allow the Human Task Module to keeps it focus in the internal logic that it handles without adding complexity related with integration.

This integration need to allows us to integrate the module in SE as well as EE environments. HornetQ (JMS implementation) will be used to demonstrate this functionality. Quartz will be used to show the scheduling capabilities that can also be offered by SwitchYard.

I've created a sample project showing how CDI services can be hooked up with Switchyard:
 https://github.com/Salaboy/human-task-poc-proposal/tree/master/human-task-switchard https://github.com/Salaboy/human-task-poc-proposal/tree/master/human-task-switchard

This project will show and demonstrate the following features:

* 
 #Introduction Introduction


* 
 #Exposing_a_Service_via_JMS Exposing a Service via JMS


* 
 #Sync_and_Async_services_calls Sync and Async services calls


* 
 #Creating_Clients Creating Clients


* 
 #Schedule_automatic_interactions Schedule automatic interactions




h1. Introduction
The human task module provides all the core logic required to manage human interactions. Using a set of services we will be able to create and interact with Human Tasks. 
In order to make the integration from different application simplier a flexible mechanism for Async and Sync calls needs to be provided, without making the internal component logic a nightmare.
h1. Exposing a Service via JMS
In order to expose our CDI service using Switchyard we will need to choose a transport and do the corresponding bindings. For this service we have chosen JMS and we will be using HornetQ as our JMS provider. 
>From the project dependencies perspective we need to add the following dependencies to our pom.xml file:
         
<dependency>
            <groupId>org.switchyard</groupId>
            <artifactId>switchyard-api</artifactId>
            <version>0.5.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.switchyard</groupId>
            <artifactId>switchyard-plugin</artifactId>
            <version>0.5.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.switchyard.components</groupId>
            <artifactId>switchyard-component-camel</artifactId>
            <version>0.5.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.switchyard.components</groupId>
            <artifactId>switchyard-component-bean</artifactId>
            <version>0.5.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.switchyard</groupId>
            <artifactId>switchyard-test</artifactId>
            <version>0.5.0-SNAPSHOT</version>
        </dependency>


In order to expose our services, defined insid the human-task module (take a look at the other wiki page to find more about the CDI human task experiment) we need to create a service wrapper which will allows us to expose each method of our interfaces into a service method: 

 https://github.com/Salaboy/human-task-poc-proposal/blob/master/human-task-switchard/src/main/java/org/jboss/ht/services/TaskInstanceEndpoint.java https://github.com/Salaboy/human-task-poc-proposal/blob/master/human-task-switchard/src/main/java/org/jboss/ht/services/TaskInstanceEndpoint.java

Switchyard imposes some restrictions about the methods that can be exposed, and for that reason our services needs to be wrapped and the arguments to the services needs to be grouped. I've defined a simple POJO called TaskUserRequest to fulfill this requirement.

We can see that the implementation of this interface is a simple facade which redirects the calls to our inject CDI service:

 https://github.com/Salaboy/human-task-poc-proposal/blob/master/human-task-switchard/src/main/java/org/jboss/ht/services/TaskInstanceEndpointBean.java https://github.com/Salaboy/human-task-poc-proposal/blob/master/human-task-switchard/src/main/java/org/jboss/ht/services/TaskInstanceEndpointBean.java

You can see the switchyard configuration file which exposes the service methods: 
 https://github.com/Salaboy/human-task-poc-proposal/blob/master/human-task-switchard/src/main/resources/META-INF/switchyard.xml https://github.com/Salaboy/human-task-poc-proposal/blob/master/human-task-switchard/src/main/resources/META-INF/switchyard.xml
h1. 
h1. Sync and Async services calls
The following figure shows how both interactions should work.

 https://community.jboss.org/servlet/JiveServlet/showImage/18985/SyncAndAsyncInteractionsSwitchyard.png  https://community.jboss.org/servlet/JiveServlet/downloadImage/18985/SyncAndAsyncInteractionsSwitchyard.png 


h1. Creating Clients

h1. Schedule automatic interactions
--------------------------------------------------------------

Comment by going to Community
[https://community.jboss.org/docs/DOC-18719]

Create a new document in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=102&containerType=14&container=2034]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120710/76f0cc60/attachment.html 


More information about the jboss-user mailing list