Showing posts with label ESB. Show all posts
Showing posts with label ESB. Show all posts

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.

Sunday, July 25, 2010

Glassfish ESB, easier than you think. Part I

Over the last 2 years I got to learn, use and enjoy OpenESB, we switched to GlassfishESB when it was released with the support of Sun. Unfortunately I am not using it anymore at work and I missed the 2.2 release in which there seems to have been a couple nice changes, but to get to the point. The concept of a ESB (Enterpise Service Bus) will seem daunting or intimidating to some people, this post is to get rid of that and show how developer friendly GlassfishESB can be. Another huge benefit people do not often mentioned is working on very large distributed applications a tool like GlassfishESB with it's visual representation of your entire deployment makes maintenance and system structural updates a lot simpler.

Anyways to begin...
Go download GlassfishESB / Netbeans / Glassfish and any other components you need here

Install it, start it up and you are probably half way done, it is that simple.

Ok so first thing you want to do is create a standard Java project.. and create some classes, for this demo I am just creating a simple "message" with a Header and Body:


Now the next bit is my way of "cheating" to actually have anything connect to the ESB process you need to have an webservice, you get that by defining a WSDL and XSD and adding them to the BPEL, but who wants to type out all that boring XML...

So now create an EJB Project:


Click next..



Click next... Finish

Add the Java project to the libs of the EJB project.



Create a new webservice...



And make sure that ... the EJBs' code looks like



Now for the cheat ...



This will generate the WSDL and XSD...

Now we create the BPEL Project


Copy the WSDL and XSD from the EJB Project..
Open the bpel... Drag the WSDL onto the little orange circle on the left, the following will popup:



Now your BPEL looks like:




Add a Receive, Assign and Reply to the BPEL, the edit the Receive:



Edit the Reply:



Click on the Assign and then on "mapper" in the bpel editor window, drag the contents of the In variable to the contents of the Out variable



Save, and done...

Now just add a composite application.



Open the Service Assmbly and drag the BPEL project onto the JBI module section:

:

Add some Endpoints from the Palette, connect the arrows:



Deploy.. and you are done.

If you like you can add a test to the Composite Application, very simple, On the Test folder, right click add, choose your main WSDL, choose the method you wanna test, it generates test xml based on the XSD. On the properties of the test set the port in ${HttpDefaultPort} in the properties of the test...and test...

In Part II , I will add some more EJBs, so that this actually becomes a functioning application and some more awesome GlassfishESB functionality.

Building KubeSkippy: Learnings from a thought experiment

So, I got Claude Code Max and I thought of what would be the most ambitious thing I could try "vibe"? As my team looks after Kuber...