Showing posts with label jbi. Show all posts
Showing posts with label jbi. Show all posts

Friday, April 18, 2008

Reply: JBI Misses the Mark by Ross Mason

I would like to reply to Ross Mason's article titled JBI Misses the Mark. It was too hard to include this in a comment, so I decided to post my reply here.

Ross,
As a JBI Component Developer and user of ServiceMix and OpenESB I am going to try my best to give some answers to your points with the goal of discussion and not persuasion. I am not a "die-hard" fan trying to push JBI adoption. So hopefully I will come off as unbiased and honest as possible.

"It’s been a few years since I read the JBI specification, but here goes."

As evidence by the different ways JBI was implemented by Apache and Sun, just reading the spec alone I think is not sufficient to disregard JBI. For example, I remember when I first read the spec and looked at ServiceMix, I was totally confused. I was asking myself, where are all the WSDLs? Most of the comments I have read from JBI opponents have usually just read the spec or heard from co-workers and have actually never used or seen JBI used. Now I am not saying this person is you Ross; you have obviously done your homework. I believe the biggest failure of JBI has been communicating clearly what JBI is and how to use it. It took me many months until I felt like I actually "understood" JBI. And before that moment happened I thought I knew what JBI was only to find out something new and that I never actually did.

"Adaptive Integration"

Unless I misunderstood it, your definition of Adaptive Integration fits well with my experience with JBI. Using JBI I can build "best-of-breed" integration solutions using any number of the JBI components available with ServiceMix (SM) or OpenESB (OESB). If I need to integrate with JDBC I can do that; or RSS, XMPP, SIP, Corba, and CICS. Perhaps my lack of knowledge of Mule capabilities is making me naive here, but to me I can use JBI to bridge multiple systems together.

"JBI attempts to standardize the container that hosts services, the binding between services, the interactions between services, and how services and bindings are loaded. The problem occurs when the APIs around all these things makes assumptions about how data is passed around, how a service will expose its interface contract and how people will write services."

In a nutshell the only thing I think JBI standardizes on is the interactions between components or put another way the format of a message that goes over the NMR. Beyond that its up to the component developers to do what they wish. For example, with the RSS BC, there are no assumptions that need to be made about incoming requests from the NMR; it's a standard JBI message. Doesn't matter if it came from a SIP, HTTP, Corba. To me that is the beauty of JBI. Once I create my JBI layer in my component anybody in the container can call me.

"Xml messages will be used for moving data around"

As stated above, JBI doesn't say if your legacy system doesn't know XML, then you can't use JBI. The exact opposite is true. To me this is the perfect fit for JBI and Binding Components. My definition of a Binding Component is a translator. It's sole job is to translate protocol X to JBI and translate JBI to protocol X. Perhaps what you are suggesting is that some message types don't "convert" easily to XML since that is what essentially messages over the NMR are. So in your example, a Cobol CopyBook message can't be or shouldn't be attempted to be converted to XML. Not sure I would agree since I would think, given a schema, anything could be represented in predictable XML.

"Data Transformation is always XML-based"

Since everything is converted to XML to be passed over the NMR, the only transformation needed for that is XML. So what you is true, but to a JBI user I guess it doesn't matter. I guess on the other side, if the NMR allowed for other message types, then yes I guess you would need more transformers, but I guess with JBI the transformers are the Binding Components.

"Service contracts will be WSDL"

This is a very true statement and I am not exactly a WSDL/XML lover; unless I don't have to deal with it. I think the original intent was there would be a lot of tooling support for JBI to alleviate that burden from the JBI user. To me Sun has done a better job of this than SM, but this is definitely a drawback to JBI. However SM has all but eliminated WSDL's in JBI so users of SM don't need tooling support since they don't actually require WSDLs.

"No need for message streaming"

Another very true statement of there not being an "easy way to stream messages in JBI". With XML being so verbose I believe SM or OESB would probably dislike a 3 MB XML file getting pumped through it. Especially if that gets copied over and over again from one component to the next. This is where JBI might have difficulties scaling. As a colleague pointed out, the content of a JBI message is XML. And that XML has to be marshalled and unmarshalled. And that process is very heavy and even more so if there are reliability/durability constraints on the Message.

However, I think its a current tradeoff in order for all components on the NMR to communicate in a predictable fashion. Since that is the main concept of JBI: the ability for all the JBI components communicate. They have to communicate some how. One component can't decide that he expects format A and another decides he requires format B. Then nothing would work. So it sounds like to me XML was that language to guarantee interoperability between components.

On a side note, JBI components have the ability to set the content of a JBI message that goes on the NMR as anything implementing the interface javax.xml.transform.Source. Meaning that they can use streaming XML with the SAX and Streaming implementations. However, once consumed, that stream is gone and is probably represented as DOM (ouch) somewhere in the process. Our components use the Streaming impl when creating JBI Messages, but that doesn't mean the others do.

Either way, I have to think that smart people like Peter Walker, yourself, and other spec leaders can't come up with something to resolve this and get the best of both worlds.

"You need to implement a pretty heavy API to implement a service"

I disagree that JBI users have to know more about JBI than is necessary, but then again its hard for me to play that person since I am also a component developer. But most of the people that I have taught how to use JBI have been successful in using it without having to know as much as me. I know in SM you can expose a POJO pretty easily. In OESB you can use the Scripting Engine or create an EJB Service to be used in JBI. From what it sounds like though, its much easier with Mule.

Again I have not had a hard time teaching non JBI users about JBI. However I skip the spec and jump straight to a demonstration of how you can use JBI. This seems to help. I remember the first video I watched when the light bulb finally went off. It was a video on how to use the Sun SMTP BC and creating a Service Assembly with Netbeans. After I watched that video everything just came together for me and my co-workers. This is basically how I start off explaining JBI: It's best explained with an example rather than a bulleted powerpoint.

"It’s not actually that clear what a service engine is in JBI."

Touche. I hear this a lot, even from me. Again, as I stated earlier, the JBI community has done a poor job of training and communicating to its users and developers. My first definition of a Service Engine was basically a Service. I still don't have a good definition of an SE; usually I will just talk about what existing SEs are out there like the BPEL and XSLT SE. To me Binding Components are easy to define so an SE is just everything else (granted not exactly the best definition).

"The JBI specification is obfuscated with lots of new jargon"

Yes, yes, and yes. Again poor job of communicating. However, the JBI user should not be concerned with most of this jargon; only the JBI developer. For example, the JBI user shouldn't need to know about what the NMR is or what it does; but it's important for JBI developers to know.

"This breaks the re-use story since, if I use a JBI Binding Component in one container doesn’t mean it will behave the same way in another container."

Ideally JBI was suppose to be this loving community of predictable containers and components. Unfortunately that hasn't exactly happened. I will say this though, from my personal experience of using different components on different containers, for the most part most components and Service Assemblies work in a predictable way on other containers. For example, I have successfully used many SM components in OESB and and I have heard of Sun components working in SM. However the failure is you can't intermix Sun and SM components (or at least from what I know). For example, you can't use the SM HTTP BC with the Sun BPEL SE. To me this wasn't a failure of JBI; only how the JBI container was implemented. In a perfect world this would have happened but it hasn't.

Ironically it actually doesn't take that much to get your components to work on both SM and OESB. Of the four components we have written (RSS, SIP, XMPP, and UDDI), XMPP has been modified to work on both. We haven't had a chance to ensure the other 3 can, but hopefully we can get to that or the open source community could help. At the time of development we didn't actually understand JBI that well and consequently when we had our components originally working in SM and tried to port them over to OESB, they worked but only with other SM components. In order for our components to work with Sun components we had to basically rewrite the JBI layer. Unfortunately, due to time constraints it was not our current goal to keep backwards compatibility with SM. It wasn't until after we finished all this that we actually understood JBI and what it meant to create a portable component.

"If you look at every JBI implementation each has written their own JMS, FILE, HTTP, FTP etc Binding components… not exactly what I’d call re-use."

You are exactly right. Each container has implemented their own components for File, JMS, HTTP. Most likely because of the issues I mentioned above. However I don't think this doesn't mean JBI can get there. If these projects wanted to make them portable than we wouldn't have this problem. Instead they focus their efforts on other things.

As a side note, since my group was using OESB, when I joined a new group, we needed to get OESB working on JBoss. This currently was not supported and my previous group was able to work with Sun to get this working and its currently being incorporated in OESB.

Summary
IMHO I think a lot of assumptions where made about JBI, but you also addressed some of the issues with JBI. One reason I think JBI has not been adopted is the fact that it didn't have the backing early on of IBM and Bea. From what I recall they dropped out pretty early once they realized it was going to be a competing product. Another reason for a lack of adoption is I think again the lack of communicating what JBI really is.

I hope I didn't reiterate responses you have heard in the past. I wasn't around when JBI was originally approved, so I don't know a lot of the history. These are just my opinions I have collected through developing components and using SM and OESB.

I hope it helps and I look forward to your response.

Thursday, April 10, 2008

Update: Using the JBI JavaEE Service Engine

Previously I wrote about how to use the JBI JavaEE Service Engine to increase performance when orchestrating EJB Services created in Glassfish with the BPEL Service Engine in OpenESB. That was almost 8 months ago and Netbeans and OpenESB have changed a lot and consequently I needed to update it.

So I would like to provide an update using the latest Netbeans (20080402).

Again, if you haven't already, go ahead and download and install OpenESB which includes Netbeans v6 and Glassfish v2.

  1. Create an EJB Module
    • File > New Project > Category Enterprise > Projects EJB Module
  2. Create a new Web Service
    • Right click on your EJB Module project
    • Choose New > Web Service
    • Add a new Operation
  3. Create a new BPEL Module
    • File > New Project > Category SOA > Projects BPEL Module
  4. Create a new BPEL Process
    • Right click on your BPEL Module project
    • Choose New > BPEL Process
  5. Create a new SOAP WSDL
    • Right click on your BPEL Module project
    • Choose New > WSDL Document
    • Go through the wizard and for the Binding Type make sure its SOAP
  6. Configure your BPEL Process by dragging the SOAP WSDL onto the left side of the BPEL Process.
    • Add the standard "buttons" to the BPEL Process Sequence
      • Receive
      • Assign
      • Invoke
      • Assign
      • Reply
  7. Utilize the EJB Web Service in the BPEL Process (this is where things are different than in past versions)
    • Right click on the Web Service under the EJB Module and select Generate and Copy WSDL
    • Uncheck Do no copy if it is checked.
    • Expand your BPEL Module and copy the WSDL into the BPEL Module's src directory.
    • Now you should have a copy of the Web Service's WSDL in your BPEL Module.
    • Drag this new WSDL onto the right side of the BPEL Process so that we can tie the Invoke call to it.
  8. Create a Composite Application
    • File > New Project > Category SOA > Projects Composite Application
    • Right click on the new Composite Application and select Add JBI Module
    • Add both your BPEL Module and EJB Module
    • Clean and build the Composite Application (Right click > Clean and Build)
    • View your CASA file by double clicking on the Service Assembly file under your Composite Application.
  9. Your CASA file should look something like this
  10. Now you should be able to start Glassfish and deploy your Composite Application. Now your BPEL Process will utilize the Java EE Service Engine. FYI, do not deploy the EJB Module separately since its included in the Composite Application.

Monday, October 1, 2007

Using the OpenESB J2SE version and netbeans

As I mentioned in JBI deployment options, OpenESB can run as a standard J2SE application. This is a nice option that has some advantages such as getting started quicker without the need of downloading the rather large (300+MB) OpenESB bundle that includes glassfish/openesb and netbeans. The JBISE version is only 4.3MB. For those of you not needing a J2EE container this might be a valid option.

The only other missing piece is the tooling support to create Composite Applications. This is included in Netbeans v6 which is a part of the large OpenESB bundle. But since you are not downloading that you need to ability to get netbeans v6. Here is the netbeans v6 nightly builds location: http://bits.netbeans.org/download/6.0/nightly/.

Good luck and happy downloading.

Wednesday, September 19, 2007

JBI Deployment Options

Recently, I have had multiple discussions with different individuals concerning possible JBI deployment options for their projects. Is Glassfish required? Do I need a JavaEE container? Do I need Netbeans? Is it packaged as a WAR? How big is the runtime footprint? If I am already using JBoss, how can I take advantage of JBI? Why is the OpenESB installer so large? Even with every project having its own specific needs, JBI has an array of potential solutions for each one. So if you are new to JBI or just curious how to use it, please contiue to read while I describe the various options.

First, I have fortunately had the pleasure of extensively using two of the most popular JBI containers currently available: Apache ServiceMix and Sun's OpenESB. The following is the landscape as I see it based off my experience.

Apache ServiceMix Options

  • Can run as a standard J2SE application. To use this version download the container from here: http://incubator.apache.org/servicemix/download.html
  • Bundled as a WAR, making it deployable to your existing JavaEE container. The WAR is also available for download from the same address above.
Sun's OpenESB Options
  • Can run as a standard J2SE application. Although it's a little more untested than it's other options. Go here for a How-To Guide on where to download the container and run it.
  • Comes bundled in an All-In-One install that includes the latest Glassfish, OpenESB, and Netbeans 6.0 for tooling support. Go here to download this version. Before you flip out on the download size (300+MB), let me provide an explanation as to the size because this seems to be the version receiving the most attention by Sun; and it's actually the version my team uses. Along with the items mentioned above, this bundle also includes all the Sun components and the latest Community Partner components. I believe the main benefit to having an All-In-One install is previously we had to download each project individually and usually the different versions where incompatible (the BPEL tooling support in Netbeans didn't match the BPEL Service Engine capabilities downloaded with OpenESB). It's important to note that with this option Netbeans is only required to compose Composite Applications and not to run OpenESB. Finally, the Glassfish and OpenESB combo is a little deceiving in that it's not like starting two applications. OpenESB is basically exploded out in one of the Glassfish domains, much like a WAR would be. So when you start a Glassfish domain, it handles starting OpenESB.
  • There exists a WAR file for IBM Websphere located here and work has been done to integrate with JBoss (read here for more information).
Which one is right for you?

Most projects fall into two categories: one that already has a JavaEE container and ones that don't. If you already have a JavaEE container, then you can use the ServiceMix WAR or run the J2SE standalone version of OpenESB. If you don't have one, then obviously you can choose among all the options. If I was forced to give a personal recommendation, I would recommend when possible using the Glassfish/OpenESB package. This gives you complete capability of building Composite Applications consisting of Web Services running in Glassfish and orchestrating them using OpenESB and the BPEL Service Engine and then integrating with other protocols such as RSS, SIP, UDDI, and XMPP. And the tooling support in Netbeans is well worth it.

For further questions please visit the FAQ on http://www.jbizint.org or feel free to drop me a comment. You can also subscribe to my shared JBI RSS Feed.

Monday, August 20, 2007

Using the JBI JavaEE ServiceEngine

Update April 10th, 2008
An update has been provided on how to use the Java EE SE in the latest version of Netbeans. Please go here to read this update.
----------

In order to familiarize myself with different JBI components I would like to walk through an example using the JBI JavaEE Service Engine written by Sun. So what is the JavaEE Service Engine? It's a highly useful JBI component providing a bridge between the web container (glassfish) and the JBI container (OpenESB), or more specifically the NMR (Normalized Message Router). It's useful because it allows EJBs and Servlets, packaged as web services, to communicate directly with JBI components and vic versa. Consequently, this increases performance since the request/response doesn't have to travel in and out of the HTTP BC and the glassfish Servlet container.

So if you are writing EJB 3.0 web services, you have alot to gain by using BPEL and JBI in general, and you need to look into using the JavaEE SE. The following is a simple example of how to use it.

If you haven't already, first start out by downloading the latest OpenESB installer which includes Netbeans 6.0. Then follow this video tutorial to create a Composite Application consisting of a BPEL process invoking an EJB web service (but not using the JavaEE SE yet). This will help us create our web service and get familiar with BPEL and Netbeans. If you prefer to skip this step I have uploaded the EJB Module, BPEL Module, and Composite Application for convenience. After completing this step your casa file should look like this (in netbeans, right click on the CompositeApplication and click Edit Application Configuration):



Notice there are no endpoints for the JavaEE SE. Here is the sequence of events when running the test included in the HelloBPELCompositeApp:
http client --> inbound HTTP BC --> BPEL SE --> outbound HTTP BC --> Glassfish Servlet Container --> invoke Hello web service --> response.

The next step is to actually utilize the JavaEE SE advantages. This only requires adding the EJB module as a JBI module to the HelloBPELCompositeApp. In JBI you can add multiple JBI Modules (Service Units) to Composite Applications (Service Assembly). In netbeans, right click on HelloBPELCompositeApp and click Add JBI Module. Select Hello, which is the EJB Module. If you expand the JBI Modules directory under HelloBPELCompositeApp, you should see Hello.jar and HelloBPEL.jar. Before we can redeploy we first must modify the casa file to remove the existing connection between the outbound HTTP endpoint and glassfish. Reopen the casa file (in netbeans, right click on the CompositeApplication and click Edit Application Configuration), and highlight the line going between the HelloRole_partnerRole Consumer to the HelloPort Provider. Your casa file should look like this now and this verifies that we are going through the JavaEE SE:



--
April 8th, 2008 Update
Since this post is pretty popular I have an update since this post doesn't work with the latest version OpenESB+Netbeans. Not only do you have to remove the line as described above, but you also need to remove the SOAP Port, otherwise you will receive an "java.net.BindException: Already bound: 8080". So in the image above highlight and delete the HelloPort.

Also in newer versions of Netbeans access to the CASA file is done by double clicking on the Service Assembly file under your Composite Application project.
--

Rebuild HelloBPELCompositeApp by right clicking and choosing Clean and Build. Then undeploy and deploy HelloBPELCompositeApp. Finally rerun the test and it should pass. Again we know the JavaEE SE is being used based off the casa file. The new sequence of events are:
http client --> inbound HTTP BC --> BPEL SE --> JavaEE SE --> invoke Hello web service --> response.

It should be obvious where the performance improvement is located. That is what makes the JavaEE SE so powerful. For convenenice, here is the final netbeans Composite Application project with the modified casa file.

If you are curious to know what netbeans was doing under the covers for us when creating the EJB Module Service Unit here is a quick explanation. In netbeans and File view you can expand the build directory under HelloBPELCompositeApp. Next expand the Hello.jar service unit. There you will see the jbi.xml and an empty sun-resources.xml. The jbi.xml file defines the endpoints the JavaEE SE must activate. These endpoints will be used by the BPEL SE consumer endpoint. Also interesting is it includes a binary of the Hello Service (Hello.class).

Tuesday, July 17, 2007

How to inject xml fragments into Netbeans BPEL Editor

Some JBI components, such as the RSS Binding Component, require specific inputs that are complex types verses simple types like xsd:string. For example when wishing to subscribe to multiple feeds at one time you need to specify an EndpointReferenceList which extends the WS-Addressing schema.

One way to populate this list is to use the UDDI Binding Component, which returns an EndpointReferenceList containing multiple addresses. However, if you want something simpler without the burden of setting up a UDDI Server ,you can also use a BPEL String literal to specify XML fragments directly in a BPEL Process using Netbeans/OpenESB.

The key is to use the Source View verses the Design View because is not currently supported in the Design View (I am using Netbeans 6.0 20070622). After creating a new BPEL Module, process, and adding a sequence, go ahead and view the process in the Source View. Now a typical Assignment in BPEL looks like the following:

<variables>
<bpws:variable name="queryUddiOut" messageType="ns1:queryUddiOutReply"/>
<bpws:variable name="rssSubscribeIn" messageType="ns2:rssSubscribeInRequest"/>
</variables>

<sequence>
.........
<bpws:assign name="BasicAssign">
<bpws:copy>
<bpws:from variable="queryUddiOut" part="part1"/>
<bpws:to variable="rssSubscribeIn" part="part1"/>
</bpws:copy>
</bpws:assign>
.........
<sequence>

This next example should be exciting as it shows how to assign an XML fragment to a variable (which can next be used as input to an invocation) using a String literal:
<bpws:assign name="AssignXmlFragment">
<bpws:copy>
<bpws:from>
<bpws:literal>
<wsa:EndpointReference>
<wsa:Address>http://localhost:18181/stockQuoteService/stockQuotePort</wsa:Address>
<wsa:ServiceName PortName="stockQuotePort">
{http://j2ee.netbeans.org/wsdl/stockQuote}stockQuoteService
</wsa:ServiceName>
</wsa:EndpointReference>
</bpws:literal>
</bpws:from>
<bpws:to>$EPRVariable/wsa:EndpointReference</bpws:to>
</bpws:copy>
</bpws:assign>

The goal of this entry was to quickly explain how you can use the BPEL editor in Source View to assign XML fragments for whatever purpose you may require. Obviously it's not the best long-term solution because this is no different than hardcoding file paths in a java program. But is very useful for quick testing.

Friday, July 13, 2007

New enhancements to the Sun XSLT SE

Kevan Simpson recently posted about new enhancements to the Sun XSLT SE. Kevan is the creator of the XSLT SE and the Common Runtime Library (CRL pronounced "coral") which is a set of utilities to help simplify creating JBI components.

Some of the enhancements include:

Transformation processes - enables a sequential list of activities to be executed as a transformation process, similar to a BPEL process.

Transformation by part - XSL stylesheets can now be applied to individual message parts, referenced by name, and explicitly assigned to other messages. Previously this was a very tedious chore.

Runtime parameter support - values for parameters defined in XSL stylesheets can be provided during runtime.

To date I haven't had the chance to play with the XSLT SE, but hope to in the next couple of weeks because I know it's going to become important in the near future.

Thursday, July 5, 2007

Great explanation of JBI concepts

Be sure to check this out. In it Brian O'Neill provides one of the best descriptions of some confusing JBI concepts for people that are new to JBI.