Jul 27

In Note 6 we explored the transactional behavior of a JCA MDB invoked by a JMS Adapter and orchestrating an Oracle JCA Adapter (a transactional end point) and a Batch Local File JCA Adapter (a non-transactional end point). In this Note let’s explore the issue of transactionality of a JCA Message-Driven Bean invoked by a non-transactional end point.

Let’s take the example from the “Java CAPS Basics: Implementing Common EAI Patterns Companion CD” book, ISBN: 0-13-713071-6, Chapter 11 “Scalability and Resilience”, Section 11.2 “Exception Handling”, subsection 11.2.1 “Exceptions in Java Collaborations”, 11.2.1.2 “Other Java Collaborations”. The book from which this section comes is available on the Companion CD. Let’s re-work this example using Java CAPS 6 JCA Adapters.

The example illustrates exception processing behaviour involving a Batch Inbound Adapter-triggered JCA Message-Driven Bean.
The Batch Inbound Adapter is designed to poll a directory for a file. When it finds a file that matches the name, or the name pattern, it immediately renames the fie by prepending a GUID to the original name then triggers the MDB and passes to it the original name of the file, the current name of the file and the directory in which the file was found. This behavior prevents other possible file pollers from getting hold of the file and gives the first comer exclusive access to the file. The MDB is designed to take the name of the file as given and rename the file to the original name with the suffix “~.in” appended, to indicate the file was read and processed. To do this the MDB will use the Batch Local File JCA Adapter’s capability to post-process the file by renaming or deleting it. To explore the transactional behavior the MDB will explicitly throw an exception after it renames the file.
The complete Note is available in 07BatcyhInboundTriggeredJCANonTransacionality.pdf.

Jul 27

Rather then inventing an example to discuss and illustrate the use of the Oracle JCA Adapter let’s build a solutions that uses the Oracle JCA Adapter and shows additional Java CAPS 6 facilities of interest.

Let’s take the example from the “Java CAPS Basics: Implementing Common EAI Patterns Companion CD” book, ISBN: 0-13-713071-6, Chapter 11 “Scalability and Resilience”, Section 11.2 “Exception Handling”, subsection 11.2.1 “Exceptions in Java Collaborations”, 11.2.1.1 “JMS-Triggered Java Collaborations”. The book from which this section comes is available on the Companion CD. Let’s re-work this example using Java CAPS 6 JCA Adapters.

This example illustrates exception handling involving a JMS-triggered JCA Message-Driven Bean.
The MDB is designed to receive a JMS message, update a field in a database table row with the value of the text message, write the text message, together with the timestamp, to a file and finish.

The complete Note is provided in 06JMSTriggeredJCAwithOracle.pdf

Update: Thanks to Dao Tien Tran for pointing out a typo on page 5. I corrected the typo and uploaded the corrected document.  Change is marked in color and with a change bar.

Jul 24

As at now there does not seem to be a way to stream FTP payloads to the local file system, or stream local files to FTP servers in the JBI environment. This kind of functionality may or may not appear in the OpenESB project, perhaps in conjunctions with the FTP BC or the File BC or both. In the meantime, a Java CAPS 6 developer can use the JCA Adapters-based solution to stream payloads of arbitrary size between FTP servers and local file systems in either direction.

This Note walks through the implementation of a Batch FTP JCA solution, which is triggered by a JMS Message, and performs a streaming FTP transfer of an arbitrarily large payload between a remote FTP server and the local file system. This Note re-implements the inbound part of the “Java CAPS 5.1 and Java CAPS 6 – Streaming Large FTP Transfers” Note available at http://blogs.sun.com/javacapsfieldtech/entry/streaming_large_ftp_transfers_with.
It should be easy enough to re-implement the outbound part of that Note using the material in this Note.

The complete Note is available in 04JCAStreamingFTPIn.pdf.

Jul 23

Java CAPS 5.x used to have a Scheduler eWay. Java CAPS 6 also has the Scheduler eWay but only on the Repository-based side. At this point in time there is no Scheduler JCA Adapter or a Scheduler Binding Component. Why would one be bothered by that? One would be bothered because there are business requirements that call for scheduling of activities. The one that comes to mind immediately is polling an FTP server for a file which to transfer. For polling the local file system there is the Batch Inbound JCA, which was used in solutions discussed in JCA Notes 2 and 3. For Batch FTP JCA there is no such thing.
Rather then ignoring the issue of lack of the Scheduler JCA Adapter I determined to see what can be done to provide this functionality for non-Repository-based Java CAPS 6 solutions.
When asked, one of my colleagues in the US suggested that EJB Timers are the way to go and provided the links to the material. I looked at what was discussed, threw up my hand in the air and exclaimed. I will not quote what I said. In short, EJB Timers may be all very well for a competent Java EE developer but not for a regular Integration, or SOA, developer. EJB Timers are, in my view, way too complex to implement and do not offer sufficient advantage over a Scheduler eWay to make it worth while to spend the time developing a solution that uses them.
The next thing I looked at was the open source Quarz scheduler, which also turned up to require more effort then I considered worth while for the Notes.
I felt that the simplest thing to do will be to use an external scheduler, a native one, provided by the OS. For Windows, on which I develop for the Notes, there is the “Scheduled Tasks” scheduler. For Unix there are Cron facilities. Both are well know and typically good enough in terms of timer resolution and scheduling flexibility. Above all else, using one does not require me to write scheduler code myself, merely write the code that triggers my solution when the scheduled event fires.
So, this Note walks through implementation of a Scheduler solution, which can be used to trigger a Batch FTP JCA solution or any other JCA-based or JBI-based solution that has to be triggered to some schedule.

Document 00Scheduler.pdf contains the entire Note.

Tagged with:
Jul 17

Java CAPS 6 has the 5.x compatibility infrastructure which allows one to import 5.x projects right into Java CAPS 6, build, deploy and run without changes. One can also develop repository-based projects in Java CAPS 6 – that’s the 5.x-style projects. This is the old way of developing Java CAPS solutions – still good and valid.

If one were to decide to not use the old way there is the JBI infrastructure, which allows development of solutions that use BPEL Service Engine, XSLT Service Engine, IEP Service Engine, Java EE Service Engine, etc., and a variety of Binding Components. The implication is that business logic is implemented in BPEL 2.0, which is used to orchestrate other services and resources, including interaction with external systems through Binding Components. This is the new way of developing Java CAPS solutions – 100% compatible with the Open Source OpenESB project since it uses the OpenESB project-developed container and components.

Someone might ask “so what happened to eGate?”. “eGate” meaning Java Collaboration Definition-like logic components, eWays and the JMS messaging backbone.

While the facility seems underadvertised/downplayed, Java CAPS 6 provides a number of 5.1 eWay-based JCA Adapters and a moderately easy means of developing JCA Message-Driven Beans that can use these adapters to implement JCD-like logic components and, effectively, eGate-like solutions that do not use BPEL or the JBI infrastructure.

This Note discusses and illustrates the implementation of a mixed Java CAPS 5.x-like integration solution that retrieves a file from the local file system using JCA Adapters and passes its content to a BPEL 2.0 process executing in the JBI container. This requirement I have seen and heard of being implemented in 5.x many times by many customers.

Most of the material in the first 16 pages of this Note is the same as in Note 2.

The JCA Message-Driven Bean, the piece of JCD-like Java logic, will be triggered by a Batch Inbound Adapter (what one would have called the Batch Inbound eWay in 5.1), will read the content of the file using the Batch Local File Adapter (eWay) and will send the payload as a string to a BPEL 2.0 Business Process, which will be triggered by this message and will execute in the JBI container. The batch Inbound Adapter will be configured to use a regular expression to match the name of the file. Once it finds the file it will rename the file by prepending the GUID to the name and will pass the new name, the original name and the directory path to the Java code. This is exactly what the 5.1 Batch Inbound does. The JCA MDB will use the new name, the original name and the directory path to dynamically configure the Batch Local File Adapter to retrieve the file content and rename the file (post transfer) to the original name with some string appended to indicate that the file was processed. This, too, is exactly what one would do in a 5.1 JCD in the same circumstance. Once the payload is available the JCA MDB will use the OneWay WSDL interface and the JBI NMR to send it, as a String, to a BPEL 2.0 process. Both the JCA MDB and the BPEL process will be a part of the same JBI Composite Application and will communicate with one another using the Normalized Message Router (NMR).

The entire Note is available in 03JCA-BInboundThroughBLFToBPEL2.0.pdf

Jul 16

Java CAPS 6 has the 5.x compatibility infrastructure which allows one to import 5.x projects right into Java CAPS 6, build, deploy and run without changes. One can also develop repository-based projects in Java CAPS 6 – that’s the 5.x-style projects. This is the old way of developing Java CAPS solutions – still good and valid.

If one were to decide to not use the old way there is the JBI infrastructure, which allows development of solutions that use BPEL Service Engine, XSLT Service Engine, IEP Service Engine, Java EE Service Engine, etc., and a variety of Binding Components. The implication is that business logic is implemented in BPEL 2.0, which is used to orchestrate other services and resources, including interaction with external systems through Binding Components. This is the new way of developing Java CAPS solutions – 100% compatible with the Open Source OpenESB project since it uses the OpenESB project-developed container and components.

Someone might ask “so what happened to eGate?”. “eGate” meaning Java Collaboration Definition-like logic components, eWays and the JMS messaging backbone.

While the facility seems underadvertised/downplayed, Java CAPS 6 provides a number of 5.1 eWay-based JCA Adapters and a moderately easy means of developing JCA Message-Driven Beans that can use these adapters to implement JCD-like logic components and, effectively, eGate-like solutions that do not use BPEL or the JBI infrastructure.

This Note discusses and illustrates the implementation of a JCD-like integration solution that retrieves a file from the local file system and writes its content to a JMS destination. This requirement I have seen and heard of being implemented in 5.x many times by many customers.

The JCA Message-Driven Bean, the piece of JCD-like Java logic, will be triggered by a Batch Inbound Adapter (what one would have called the Batch Inbound eWay in 5.1), will read the content of the file using the Batch Local File Adapter (eWay) and will write the payload as a string to a JMS destination. The batch Inbound Adapter will be configured to use a regular expression to match the name of the file. Once it finds the file it will rename the file by prepending the GUID to the name and will pass the new name, the original name and the directory path to the Java code. This is exactly what the 5.1 Batch Inbound does. The JCA MDB will use the new name, the original name and the directory path to dynamically configure the Batch Local File Adapter to retrieve the file content and rename the file (post transfer) to the original name with some string appended to indicate that the file was processed. This, too, is exactly what one would do in a 5.1 JCD in the same circumstance. Once the payload is available the JCA MDB will use the JMS OTD to send it, as a TextMessage, to a JMS Queue. Again, this is something that a 5.x JCD would do.

In effect, this Note describes and illustrates the process of re-creating a 5.x Java Collaboration Definition using Java CAPS 6, but instead of using the repository-based approach it is using JCA MDBs and JCA Adapters.

Complete text of the Note is in 02JCA-BInboundThroughBLFToJMS.pdf

Jul 14

Someone asked a question along the lines of “Is it possible to develop a solution in OpenESB where the HTTP BC receives a request and the SMTP BC uses it to send electronic mail with no BPEL logic to tie the two together”. I though that the answer was “Yes” but I felt I had to verify it. Vishnuvardhan Piskalaramesh from Sun, who is looking after the SMTP BC, and Sherry Weng from Sun, who is looking after the HTTP BC, helped along and here is the result.

This note describes, with illustrations, a mini integration solution wherein an appropriately formulated HTTP GET request is used to submit an electronic mail to a SMTP server, using the HTTP Binding Component and the SMTP Binding Component, without the need to provide any transformation logic. This is another example where a
practical JBI-based integration solution can be constructed in minutes.
05JBI_HTTP2SMTP_NoBPEL.pdf provides the illustrated discussion.

Jul 11

In addition to doing it the hard way, which is something a developer could always do and frequently did, Java CAPS 6 gives a developer 4 ways in which to receive messages from a JMS Destination. Two of these will be familiar to the Java CAPS 5.x developer and involve a JMS-triggered JCD and a JMS-triggered eInsight BP. Of the two additional ways in Java CAPS 6, one involves the use of the JBI infrastructure through the JMS Binding Component (JMS BC) and one involves the use of the just introduced evolution of the 5.x eWays variously referred to as Global RARs or Java 1.5 EE JCA adapters.

This discussion revolves around the JCA adapter use and points out, appearances notwithstanding, how easy it will be for a JCD developer to develop JCD-equivalent ‘collaborations’ using JCA adapters in Java CAPS 6.

Note that OpenESB does not provide this functionality and that this functionality has nothing whatever to do with the JBI.

Credits go to Frank Kieviet and others who proposed and oversaw the evolution of the eWays into JCAs and Dao Tien Tran whose JCA tutorial helped me get started.

Here is the document that discusses the topic: 05JCA-basedJMSConsummer.pdf

Tagged with:
Jun 21

The attached document explores the ability of Java CAPS 6/JBI and OpenESB to expose and execute Java-based logic as a JBI service. It walks through the process of creation, deployment and execution of a simple File-to-File integration solution that reads an XML record from a text file, invokes java logic that operates on that record then writes the XML response record into a file.

04File2FileJavaEE.pdf

There are errors in pictures on pages 12 and 13. The WSDL name in the pictures does not correspond to the name in the text. This error is corrected in revision 1.1 of the document, 04File2FielJavaEE_1.1.pdf. Thanks to Juraj Kazda for spotting the issue.

Jun 15

The attached document briefly explores the Encoder aspect of Java CAPS 6/JBI and OpenESB. It walks through the process of creation, deployment and execution of a simple File-to-File integration solution that reads comma-delimited record from a text file, ‘decodes’ then into XML and writes the XML-equivalent records into a file. The project is then extended to ‘encode’ XML records back to CSV format on output.

The focus is the practice of using JBI components not the theory of JBI.

This document addresses the integration solution developers, not developers of Service Engines or Binding Components.

The project uses JBI components only, that’s why it is just as good for OpenESB exploration as it is for Java CAPS 6/JBI exploration.

JBI (Java Business Integration) is not discussed to any great extent. JBI artifact names are used in discussion but not elaborated upon. Explanations are provided where necessary to foster understanding of the mechanics of developing integration solutions using JBI technologies in OpenESB and Java CAPS 6/JBI.

Java CAPS 6 and OpenESB are two of a number of toolkits that implement the JBI specification (JSR 208). When I use an expression like “In JBI …” I actually mean “In JBI as implemented in Java CAPS 6 and OpenESB …”. The same things may well be implemented differently in other JBI toolkits.

Java CAPS 6 “Revenue Release” is used and shown in illustrations. OpenESB can be used instead however the appearance of components shown in illustrations may vary somewhat.

I use Windows to develop these solutions and make no effort to verify that the solutions will run on other platforms.

The complete walkthrough is here.

preload preload preload