Tuesday, August 3, 2010

Glassfish ESB, easier than you think. Part II

To continue from Part I, which simply just went in and out of the BPEL process, I will now add a couple EJBs to show a nice little Glassfish ESB structured activity, namely: Flow

Since this is now getting a little larger, I have made all the demo source available ... here.

So using the EJB project Wizard I create 2 EJB projects: DemoEJB1, DemoEJB2
once you have the project, Add a webservice:



For demo purposes I am going to have 2 web services with 2 methods, gatherAppData and gatherHistoryData, these 2 functions can happen concurrently and cause you no pain as long as you change different data in your object model.
Once that is done, from the project menu select the web service, drag it over to the right hand side of the BPEL editor, on the orange circle.



Then update the Partner Link information that pops up.


To execute the 2 web service calls concurrently you will need a "flow", grab that from the structured activities.



From the web service palette grab 2 invoke objects and place them in the flow.

Edit the invoke objects, choosing the different webservices.


Create variables for both, in and out. Try stick to a naming convention of some sorts as when you get to 20ish components it can get very messy.



So now the BPEL will look something like the following.


You can add as many concurrent steps to a flow as you like or as many different values you have within your object model.
To get these 2 invokes to function we need to assign the input and output variables and then assign the result of both to the output variable of the BPEL process. For each assign, map the input variable of the BPEL to the input variable of the relevant data for the service that is being called. In the 3rd assign map the relevant part of the each output variable to the output variable of the BPEL.

just for clarity here is the last assign in the mapper view.



And that is it... 2 concurrent web service requests within a Glassfish ESB process



The final steps are to add the newly created EJBs to the "Service Assembly" in the composite application, you can just drag the EJB project directly onto the middle JBI section, build, deploy and test.

No comments:

Post a Comment

Popular Posts

Followers