Joomla Popin Window by DART Creations

Sponsors

JBoss Books

Support this site buying books here

Merry Xmas

Banner

Designed by:
SiteGround web hosting Joomla Templates
JBoss ESB PDF Print E-mail
Written by F.Marchioni   
Thursday, 09 October 2008 12:46

As you certainly know, the word SOA has become recentely one of the most hyped in the IT. Almost everyone wants to offer a SOA as a solution to all your problems, but is it true ? well for SOA to be embraced and deliver on its promises, businesses must be able to develop and launch their services in ways that match their organizational and financial realities. 


If SOA is too expensive, complex or politically challenging, the technology won’t take off. How, then, is it possible to build an SOA that overcomes political and cost constraints? Driving an SOA strategy to success in a large organization requires a corporate-level CIO with the power to drive a vision, enforce a set of architectural goals and blueprints, and mediate financial allocations.

 

To get a manageable SOA, you’ll need to start with SOA platforms that represent a relatively low investment. That’ll likely mean tools and platforms that are open source, with support and ecosystem benefits available at a low cost.

JBoss team have designed their own Service Bus: JBoss Enterprise Service Bus  is a robust SOA solution designed since the release 4.2 with build-in fail-over, load balancing and delayed message redelivery. JBossESB allows you to distribute service instances across many nodes. Each node can be a virtual or physical machine running one or more instances of JBossESB.

How the physical implementation of the architecture is achieved -however- is not fundamental: in fact many different implementations and sub-architectures could be used. So what is the fundamental concept or idea in which to work when considering SOA?

The fundamental of SOA is a unitary event bus which is triggered by receipt of a Message: a service registers with this bus to be informed when messages arrive. Next up the chain is a handler (dispatcher), that allows for sub-services (sub-components) to register for sub-documents (sub-messages) that may be logically or physically embedded in the initially received message. This is an entirely recursive architecture.

 






JBossESB does not impose restrictions on what constitutes a service: this allows for the implementations to change without requiring clients/users to change. Only changes to the message definitions necessitate updates to the clients.

As such, JBossESB uses a message driven pattern for service definitions and structures: clients send Messages to services and the basic service interface is essentially a single doSomething method that operates on the Message received. Internally a service is structured from one or more Actions, that can be chained together to process incoming the incoming Message. What an Action does is implementation dependent, e.g., update a database table entry, or call an EJB.

So when developing your services, you first need to determine the conceptual interface/contract that it exposes to users/consumers. This contract should be defined in terms of Messages, e.g., what the payload looks like, what type of response Message will be generated (if any) etc.

 

How is made up a Service in JBoss ESB?

A service in JBossESB is defined a list of Action classes that process an ESB Message in a sequential manner. This list of Action classes is referred to as an Action Pipeline. A Service can define a list of Listeners, which act as inbound routers for the Service, routing messages to the Action Pipeline.
jboss esb
Picture 1: Action pipeline

JBossESB supports two forms of listener configuration:
1. Gateway Listeners: These listener configurations configure a Gateway Endpoint.
These Endpoint types can be used to get messages onto an ESB bus. It is responsible for adapting the message payload by wrapping it into an ESB Message before shipping it to the Service's Action Pipeline.
2. ESB Aware Listeners: These listener configurations configure an ESB Aware Endpoint. These Endpoint types are used to exchange ESB Messages between ESB Aware components i.e. exchanging messages on the bus.
 

Step 1 : Download the ESB

Ok, now let's get our hands dirty: at first download the latest ESB from jboss site:

http://www.jboss.org/downloading/?projectId=jbossesb&url=/jbossesb/downloads/4.4.GA/src/jbossesb-4.4.GA-src.zip

The jbossesb-server binary distribution is a pre-configured profile based on the JBoss Microkernel architecture. The ESB Server comes pre-installed with JBoss Messaging, JBoss Webservices, all of the base ESB capabilities and is the best choice for those who want to get started quickly.
 

Step 2: Download the ESB Eclipse Plugin:


For our first sample we'll use the Eclipse IDE because there's available an ESB plugin. The plugin ships with an HelloWorld example which simply sends a message to our Service in one case using the JMS gateway listener as broker, in another case directly to the ESB .

From your Eclipse Menu select Software Update--->Find and Install
You need to add a new remote site to the list. The link of the remote site is

http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/tools/updatesite/

Ok. Now restart Eclipse and Let's build a new ESB project.
 

Step 3: Create a new ESB Project from Eclipse:

As you can see the Project has already some sources in it: it's a simple Service called MyJMSListenerAction.java which has a method displayMessage. The method prints out the content of the message.

 

package org.jboss.soa.esb.samples.quickstart.helloworld;

import org.jboss.soa.esb.actions.AbstractActionLifecycle;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.message.Message;

public class MyJMSListenerAction extends AbstractActionLifecycle
{
    
  protected ConfigTree	_config;
	  
  public MyJMSListenerAction(ConfigTree config) { 
   _config = config; 
  } 

  public Message displayMessage(Message message) throws Exception{
		
   System.out.println("Body: " +message.getBody().get());		  
   return message; 
        		
  }
    
	
}

How is this service configured ?

The main configuration file is jboss-esb.xml file : you can find it in the root of your eclispe project:
 

<?xml version = "1.0" encoding = "UTF-8"?>
<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd" parameterReloadSecs="5">
    <providers>
          <jms-provider name="JBossMQ" connection-factory="ConnectionFactory"
                        jndi-URL="jnp://127.0.0.1:1099" jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
                        jndi-pkg-prefix="org.jboss.naming:org.jnp.interfaces">
                      
              <jms-bus busid="quickstartGwChannel">
                  <jms-message-filter
                      dest-type="QUEUE"
                      dest-name="queue/eclipse_quickstart_helloworld_Request_gw"
                   />
              </jms-bus>
              <jms-bus busid="quickstartEsbChannel">
                  <jms-message-filter
                      dest-type="QUEUE"
                      dest-name="queue/eclipse_quickstart_helloworld_Request_esb"
                  />
              </jms-bus>
          </jms-provider>
      </providers>
      
      <services>
        <service 
         category="FirstEclipseServiceESB" 
         name="SimpleListener" 
         description="Hello World">
            <listeners>
                <jms-listener name="JMS-Gateway"
                    busidref="quickstartGwChannel"
                    maxThreads="1"
                    is-gateway="true"
                />
                <jms-listener name="helloWorld"
                              busidref="quickstartEsbChannel"
                              maxThreads="1"
                />
            </listeners>
            <actions>
                   <action name="action1" 
                    class="org.jboss.soa.esb.samples.quickstart.helloworld.MyJMSListenerAction" 
                    process="displayMessage" 
                    />      
            </actions>
        </service>
      </services>
     
</jbossesb>

This configuration file is divided into two main sections: the first section is the JMS provider configuration where you can find 2 configuration filters: one for the quickstartGwChannel and the other for the quickstartEsbChannel.

The second section describes the service itself and the listeners : as you can see there are
also 2 types of listeners: a pure JMS Gateway listener and a ESB aware Listener.

As said before the JMS gateway listener is responsible for carrying the message to the ESB (adapting them to the ESB "style") while the ESB Aware listener is used to exchange message to ESB aware components.





In the example downloaded it's possible to run 2 kind of samples: I suggest you to click on the build.xml ant file so you can run tests directly from the Outline window -see picture below:

jboss esb soa

The "sendesb" sample runs the test by simply putting an ESB aware message to the queue
queue/eclipse_quickstart_helloworld_Request_esb. This is fairly trivial example. The second
example "runtest" is a bit more complicated as it requires interaction between the two listeners:
See the picture below:

jboss esb

 

In step 1, the JMS client send a raw JMS message to the queue "queue/eclipse_quickstart_helloworld_Request_gw".

The JMS listener receives the raw JMS message (step 2) and adapts the message to the ESB aware message format, but before doing this, it needs to know the endpoint of the Service. So the JMS listener first contact (step 3) the Service Registry  (that keeps track of all Service Endpoints References), then normalize the message and place in the the JMS queue "queue/eclipse_quickstart_helloworld_Request_esb"  (step 4)

When the message is placed in this queue the Service "MyJMSListenerAction" is triggered and the content of the Message is extracted and passed to the displayMessage (see step 5).

 

Packing an ESB project

One more file extension ! After jar, war, ear, sar and har we now have a new type of archive called esb! An esb archive is one of the new features of our upcoming release and it packages up both your configuration and your custom code (action classes) in one neat package. The structure of the esb archive looks like:
jboss esb

the jboss-esb.xml is the main configuration file and it contains the service configuration (listener and actions as we saw before).
the deployment.xml is optional, but can be used for 2 reasons:

  • make this .esb archive depend on other archives/MBeans to specify classloading order (this includes message queues).
  • make the deployment of this .esb archive scoped

then on the root you'll place your action classes and additional  jar archives your actions depend on.
Finally the jb-queue-service.xml: there you can place the queues and topics referenced in your esb project.

Two little patches:


at the time of writing the eclipse plugin delivers this sample with some methods deprecated:  please verify that your custom action contains this method message.getBody().get() to display the message:

  public Message displayMessage(Message message) throws Exception{
    .....  
    System.out.println("Body: " +message.getBody().get());    
    return message;
          
 }


Also in your SendEsbMessage check that you're setting properly the property "javax.xml.registry.ConnectionFactoryClass"

public class SendEsbMessage
{
  ......
    public static void main(String args[]) throws Exception
    {
      System.setProperty("javax.xml.registry.ConnectionFactoryClass",
         "org.apache.ws.scout.registry.ConnectionFactoryImpl");
    }

Enjoy JBoss ESB !

References:
JBoss ESB blog: http://jbossesb.blogspot.com/
JBoss ESB documentation: http://www.jboss.org/jbossesb/docs/index.html
 

 


JBoss.org Search
Custom Search
Comments
Search
logoff   |147.83.113.xxx |2008-10-14 13:50:04
who knows how to use bidirectional ESB message queues, without JMS gateways? if
it is possible...
Alessandro I.  - unaware webservice endpoint   |81.208.61.xxx |2008-10-23 12:24:17
We would like how the JBoss ESB and the consumer manage an unaware webservice
request.
admin   |SAdministrator |2008-10-23 13:38:21
There must be a few examples under samples\quickstarts (you must download
JBoss ES which explain webservice-ESB interaction...take a look
there....
regards
Andre  - NameNotFoundException   |141.76.82.xxx |2008-10-28 16:22:33
Hi, I'm new to JBoss ESB and don't have a complete picture yet...

Building
the runtest example returns the following error:

Exception in thread
"main" javax.naming.NameNotFoundException: eclipse_quickstart_
helloworld_Request_gw not bound


Any ideas how to solve this?
Thanks and regards,
Andre
Mark   |83.103.35.xxx |2008-10-29 10:32:19
Hi Andre,
do you have in your "jbmq-queue-service.xml" the MBean that
contains the reference to the Queue
"eclipse_quickstart_
helloworld_Request_gw 4; ?
regards
MS  - Eclipse plugin not found   |139.72.158.xxx |2008-11-12 00:41:51
I could not find the Eclipse plugin in the URL mentioned in this article.


*****//anonsvn.labs.jboss****/labs/jbossesb/tr
unk/product/tools/updatesite/

When tried using Eclipse Update tool, I gett
"No repository found" Error.
I am using Eclipse 3.4.1.
admin   |83.103.35.xxx |2008-11-12 13:28:46
That's a bit odd because the link seems to be active. Anyway download the file
from
http://anonsvn.labs.jboss.com/labs/jbossesb/
trunk/product/tools/updatesite/plugins/org.jboss.s
oa.esb.eclipse.template_1.1.1.jar
and try copying it under the
"plugins" directory of Eclipse. Restart eclipse and see if it's
working...
MS   |139.72.158.xxx |2008-11-12 21:03:55
Thanks, this works.
Vishal Pandya   |71.225.116.xxx |2008-12-17 18:24:18
When I try to create an ESB project, it asks for two locations,
1)ESB Install
Location
2)Application server Location

I would like to know that what path I
should specify?
I have downloaded the above mentioned version of
JBossESB.

Thanks.
Only registered users can write comments!

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

Last Updated ( Tuesday, 28 October 2008 08:09 )
 

Valid XHTML and CSS.

Unless stated, all the contents of this site is licensed under
Banner