Setting up WebSphere ESB to Consume Messages from JBoss

Let’s look at how to pick up messages from an external JMS messaging provider (in this example, we’ll use JBoss), using the new Generic JMS Binding support in WebSphere ESB 6.1.

Firstly, create a JMS connection factory and queue (destination) in JBoss, or your external messaging provider.
Then, you need to set up the generic JMS provider administratively in WebSphere. Open the Admin Console for your server, and navigate to Resources / JMS / JMS Providers. Create a new JMS Provider at the scope that’s relevant to you. Give it a name (something simple – in this case, we’ll call it JBoss), and specify the initial context factory and the external provider URL. In our case, these are org.jnp.interfaces.NamingContextFactory and jnp://our.jboss.server.name:1099/. To find out what these are, you’ll need to consult the documentation for your JMS provider.

Next, you’ll next to make sure that the class you specify is available to the WebSphere server. Locate the JAR that contains it (in our case, it is called jbossall-client.jar and is distributed by JBoss). Place that JAR in the lib/ext/ directory of your server (and make sure to restart it).

Next, let’s create the mediation module. Start up WebSphere Integration Developer, and create a new Mediation Module. In our case, we’ll assume that the messages we are picking up from JBoss are JMS Bytes messages, so we are going to take the easy route and use the Simple JMS Bytes Data Binding. You could, of course, use a custom data binding.

Create a Library, and add the ‘Schema for Simple JMS Data Bindings’ to it. Make sure the mediation module depends on the library. Next, create an interface, and give it a single one-way operation, with a single parameter of type JMSBytesBody. This means that the interface will correspond to what the data binding we will use expects.

Add an export to the mediation module, and add the interface you just created to it. Now right-click, and select ‘Generate Binding / Message Binding / Generic JMS Binding…’. Leave the default of ‘Configure new messaging provider resources’. Don’t be fooled, you still need to create everything but the listener port. For ‘Generic JMS provider name’, enter the name you entered earlier in the Admin Console. For the connection factory and recieve destination, enter the JNDI values defined for these resources in JBoss. Add a data binding (as mentioned, in our case we are using the ‘Simple JMS BytesMessage Data Binding’), and a function selector. The default function selector will use the TargetFunctionName JMS header as the native method name – you can write a different function selector by implementing the commonj.connector.runtime.FunctionSelector interface, as we did for our example. Select OK to create the binding. Make sure your method bindings match the behaviour of your function selector.

You’ll probably want to connect your export to a mediation flow – initially, you can just display the SMO to see whether it’s working as intended.

Now, deploy the mediation module to your server. You should find it starts consuming messages from your JMS provider.

Advertisements

6 Responses to Setting up WebSphere ESB to Consume Messages from JBoss

  1. Vivek says:

    I was wondering how does this work in a clustered env. For both WPS and JBoss clustered?

    What would be the “external provider URL”? Would it point to one box or another one?

  2. @Vivek, not sure, I’m afraid.

  3. Vivek says:

    Thanks andrew

  4. overhead says:

    In clustered env obviously you will need load balancer that will provide certain endpoint. Basically – for example endpoint would be : my.endpoint:1111 and load balancer would direct request to the server1 or server2. If you want to access direct server, you could do it also by bypassing load balancer, something like server1(2).my.endpoint:1111

  5. a says:

    How IBM ESB can place a message on JBOss queue. Please help with steps

  6. Puneet says:

    Andrew,

    How could we configure JBoss ESB to consume messages made available by Websphere application server default messaging.

    I am using WAS 6.1 & JBoss ESB 4.3.

    I could find material on integration of Websphere MQ & JBossESB but not with Default Websphere messaging.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: