Welcome!

.NET Authors: Lee Novak, Liz McMillan, Mark O'Neill, Peter Silva, Yakov Werde

Related Topics: .NET

.NET: Article

Constructing a JMS Adapter for Microsoft BizTalk Server

Create adapters for BizTalk/J2EE interoperability

Set Up and Run the Java Client Programs
We have included Java JMS receivers and transmitters; they can be found in the Java clients folder. The source code for these JMS client programs is supplied, and you are encouraged to examine it. They are typical JMS clients. If you are using a different application server or have installed WebLogic Server in a nondefault location, you may need to modify some of the parameters in the source code, or change the build classpath to reference different Java libraries.

Start up a sender client for queue1 (the orchestration's input queue), and receivers for queue2 and queue3 (the orchestration's executive and general employee output queues, respectively). There are .bat files supplied for exactly this purpose. If you are using a different application server, or if WebLogic Server is installed in some nondefault location, you may need to edit the runtime classpaths before running these .bat files.

Run the Orchestration
Now that the JMS server, the orchestration, and the Java clients have all started, we can now supply data to the orchestration and watch it run. Consult Figure 4 to see the architecture of the solution and how the orchestration ports, the JMS queues, and the JMS clients relate.

First, supply an employee record through the queue1 sender. You will be prompted for a grade level. Use grade level 2 (an ordinary employee). You will now be prompted for first, middle, and last name, ID number, and birth date. Make something up (Figure 5). The sender program will compile the information in an XML record and submit it to the JMS queue named queue1. The JMS adapter will read the record off queue1 and submit it to the orchestration on the jmsFromInputQueue receive port. As an ordinary employee record, it will be output on the jmsToHRQueue send port, from which the JMS adapter will place it on the queue3 JMS queue, and the record will be received by the queue3 receiver and displayed (Figure 6).

Now, do the same thing with an executive record. Enter a grade level of 7, plus the additional information (Figure 7). This will cause an XML version of the record to be submitted on queue1, and received by the JMS adapter from queue1 and submitted to the orchestration on the jmsFromInputQueue receive port. A copy of the record will be transformed and output to the jmsToExecQueue, from where the JMS adapter will submit it to the queue2 JMS queue, so that it is displayed by the queue2 receiver (Figure 8). In addition, the original record is output to the jmsToHRQueue send port, transmitted to queue3, and received and displayed by the queue3 receiver (Figure 9).

When you are done working with the example, you can close the JMS clients, stop the orchestration, and shut down the WebLogic Server.

Summary
This article shows how a JMS adapter for BizTalk Server can be constructed using the JNBridgePro Java/.NET interoperability tool. With this information you should be able to construct your own JMS adapter, construct adapters to other Java-based software, or simply call Java libraries from BizTalk Server orchestrations, using a Java/.NET bridging tool such as JNBridgePro.

As described, the adapter has a number of hard-wired parameters that target it to the WebLogic Application Server. It is relatively simple to retarget the adapter to a different app server, or generalize it so that the parameters can be assigned at runtime.

The creation and deployment of adapters can seem like an involved process, but once you get past the details inherent in the creation of any BizTalk Server adapter, creating an adapter that bridges between BizTalk Server and J2EE is quite straightforward.

Resources

More Stories By Wayne Citrin

Wayne Citrin is the CTO at JNBridge. He is the architect of JNBridgePro, and has been engrossed in Java and .NET interop issues since .NET’s beta days. Previously Wayne was a leading researcher in programming languages and compilers, and was on the Computer Engineering faculty at the University of Colorado, Boulder. For more information on Java and .NET interop, visit Wayne’s blog at www.jnbridge/com/blog.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.