Thursday May 15, 2008

One of the most common questions I get asked is, "Will Sun support OpenESB?" or "Is Java CAPS a supported version of OpenESB?" Developers want to get started now with functionality in Open ESB and feel confident that it will be supported by Sun with a Java CAPS license.

We do already have some JavaCAPS customers who are entering the development phase of their projects with Open ESB in the knowledge that the infrastructure will be a supported part of Java CAPS by the time they go to production. Unfortunately, the answer to the original questions is a little more detailed than simply "yes" or "no". Let me explain...

Java CAPS 6 is, to grossly oversimplify it, Java CAPS 5 + some OpenESB technology. However the first release of Java CAPS 6 will not include all OpenESB components. This is for a couple of reasons:

  • Not all openesb components have been through the necessary QA to make them ready for production yet.
  • Not all openesb components are developed by Sun, so it is impossible for Sun to support them.

When Java CAPS 6 is released, it will consist of some openesb components. For instance:

  • JBI runtime.
  • BPEL SE
  • HTTP BC
  • JavaEE SE

During the rest of 2008, Sun will continue to make other openesb components production ready and make them supported parts of Java CAPS. The exact content and timeline of these "Component Packs" or is still to be released, but you can probably expect them to include:

  • IEP SE
  • JDBC BC & SQL SE
  • JMS BC
  • XSLT SE
  • File BC
  • others.
(note: I'm not in product management so this isn't an official list, just an indication)

Additionally, Sun may enter agreements with the companies who are developing other openesb components and make them "supported" parts of Java CAPS. So it is possible that OpenESB components that are not developed by Sun will also be supported by a Java CAPS license.

To give you an example. I currently have two Java CAPS 6 "customers", even though it has not yet been released.. They have looked at their requirements and see that they need only components which will be available in the initial release of Java CAPS 6 or will most likely be available in Component Packs in 2008. They have started development work now and plan to be in production in 2009. By 2009, all OpenESB components they need will be supported parts of Java CAPS.


 

Monday May 05, 2008

I've created a new screencast which provides an overview presentation of OpenESB, including how JBI works, and how OpenESB relates to JavaCAPS.

Having run OpenESB workshops with companies for almost 18 months now, I realise that it is easy to misunderstand the how a JBI-compliant infrastructure operates and also what information is needed by developers to design and build solutions.

JBI is a standard for infrastructure developers and the inner-workings really are not always relevant for developers building applications with a JBI compliant infrastructure. However, app developers should have an understanding of the basic concepts to understand what is happening. Many developers also like to know what is happening "under the covers" so that they fully understand how issues like performance, security, and transactions are handled by the infrastructure. Hopefully this presentation provides that information.

The presentation walks through an example, actually the tutorial problem which was detailed in the last entry, and explains how service interaction occurs and the role of the normalised message router from the developer's perspective.

Friday Jan 25, 2008

I've created a set of screencasts showing how to build a simple composite application using OpenESB. The goal is to build something simple which shows multiple Service Engines and Binding Components to reinforce the concepts of Java Business Integration. The Demo Project is an over simplified Loan Application Process (there is an unwritten rule that all vendor demos must use a banking applications :). The composite application consists of the following parts:
  • the process orchestration is implemented in BPEL
  • the process should be exposed to Applicants as a WS-I Basic Profile compliant webservice
  • the process invokes a JavaEE EJB to performing the processing of the loan application
  • after processing, the process invokes a ReportMail Service which is running remotely and can only be communicated with through JMS
  • finally, the capability to invoke the Loan Application Process through the file systems (e.g., incoming ftp msg) in addition to a webservice endpoint is added.

Thursday Mar 16, 2006

This entry shows how JavaDB can be used as an embedded database to act as a cache for services deployed in the Sun Application Server.

I was recently working on a project where we needed to wrap a legacy application as a reusable Service. This wrap&reuse situation is something we often encounter. For instance:

  • A read-only Service must exist to return information to external clients
  • The information changes quite slowly
  • That data exists in a legacy backend system.
  • The cost of communicating with the legacy system is relatively high. This can be because of both communication time and financial cost because the legacy system maybe remotely hosted.

So, I thought it would be a good chance to try JavaDB / Derby as an embedded database to cache the results of the legacy system calls in the Service itself to limit the amount of communication with the backend. This is a simplified version of how I got to work.

The first step is to get JavaDB installed on your machine. There is an article over at Linux-Mag that provides a simple guide for doing that.

When JavaDB is used in embedded mode there can only be on client connected to the DB at a time. So you need to create the table, copy the embedded database libraries to the appserver, then restart the appserver. When the appserver restarts it creates and maintains the client connection to the embedded database.

Start by making a table to store the cached data.

bash-3.00$ java -Dderby.system.home=/export/home/jb156719/DerbyDB org.apache.derby.tools.ij
ij version 10.1
ij> connect 'jdbc:derby:serviceCacheDB;create=true';
ij> create TABLE SERVICE_CACHE (id_num varchar(11) PRIMARY KEY, serviceData varchar(10000), timestamp TIMESTAMP);
0 rows inserted/updated/deleted
ij> select * from SERVICE_CACHE;
ID_NUM |SERVICEDATA |TIMESTAMP
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------

0 rows selected
ij> quit;

Add the jar for embedded derby to the appserver library path

cp $DERBY_INSTALL/lib/derby.jar $AS_HOME/domains/domain1/lib/ext

Create the JDBC resource and connection pool in the App Server.

In the App Server console create a new Connection Pool in the JDBC Resources section. Provide a connection pool name, in this case it is serviceCachePool , and set the ResourceType to be javax.sql.DataSource

For the datasource classname, set the value to org.apache.derby.jdbc.EmbeddedDataSource

In the properties fields set the DatabaseName to the full path of the database you created previously using the ij tool. In this case it is /export/home/jb156719/DerbyDB/serviceCacheDB.

Create the JDBC resource using the newly created connection pool and make it available on the server you are using. The name in this example its jdbc/serviceCacheDB.

Create your Service. In this example, I've generated an J2EE-based webservice from a WSDL using Netbeans.

Add the necessary JDBC resource references to your Service. For the EJB-based webservice you need to modify the ejb-jar.xml and sun-ejb-jar.xml

Greg Sporar's blog entry has more details on adding these resources.

Then you just write your code to use the JDBC resource within your service. In this simple example, my service endpoint code checks if the data is in the cache, adds it to the cache if it is not, then returns the result.

import ...

public com.sun.services.HelloWorldServiceResponse sayHelloWorld(com.sun.services.HelloWorldServiceRequest recipientsListRequest) throws
com.sun.services.HelloServiceFault, java.rmi.RemoteException {

String resultS = checkLocalCache(recipientsListRequest.recipient);
if (resultS == null)
putStringtoDB(recipientsListRequest.recipient);
HelloRecipient hr = new HelloRecipient(recipientsListRequest.recipient + " " + resultS);
HelloRecipient hrs[] = new HelloRecipient[1];
hrs[0] = hr;
com.sun.services.HelloWorldServiceResponse _retVal = new HelloWorldServiceResponse(
hrs);
return _retVal;
}
private String checkLocalCache(String personName) {
DataSource dataSource;
try{
dataSource = getCacheDB();
}catch(NamingException e){
...
}
...
try{
conn = dataSource.getConnection();
String sqlQuery = "SELECT * FROM SERVICE_CACHE where id_num = '" + personName + "'";
prpStmt = conn.prepareStatement(sqlQuery, ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
rs = prpStmt.executeQuery();
if (!rs.first())
resultS = NO_CACHE_RESULTS;
else {
resultS = rs.getString(2);
Timestamp ts = rs.getTimestamp(3);
rs.close();
long millisecs = System.currentTimeMillis();
Timestamp tsOld = new java.sql.Timestamp(millisecs - STALE_CACHE_AGE);
if (ts.before(tsOld)) {
sqlQuery = "delete FROM SERVICE_CACHE where id_num = '" + personName + "'";
prpStmt = conn.prepareStatement(sqlQuery);
prpStmt.executeUpdate();
}
}catch(SQLException e){
...
}finally{
// close the connection
}
if (resultS.startsWith(NO_CACHE_RESULTS)) {
return (String) null;
} else {
return (resultS);
}
}

That's it. It was certainly fast enough for the solution I was working on. Of course, I've avoided all the intereting questions such as, "How does it benchmark compared to an external database?", "How will your caching strategy work when you have a load-balanced, clustered, HA solution?", "What happens when I want a read-write service?". But an embedded DB is certainly worth a try for speeding up simple "wrap & reuse" services.

Wednesday Mar 15, 2006



John Clingan can be quite persuasive...

I'm a software architect here at Sun and I work on a number of customer engagements. At the moment that means a lot of work in the SOA space. For some reason there is quite a lot of it going on in Scandinavia right now.

I try to avoid becoming a powerpoint architect by adhering to the ArchitectAlsoImplements pattern [1], and I'll try to keep this site as practical as possible by discussing problems and solutions that occur in real situations that I'm working on. Of course, having said that, I'm just as capable of drifting off into an unsubstantiated ramble about SOA as the next blogger[2], so we'll see how it goes.

[1] From Harrison, N. and J. O. Coplien (2004). Organizational Patterns of Agile Software Development. Very useful book by the way.
[2] As you may have guessed from the bordering on the pretentious by-line which is pilfered from the book, The Existential Pleasures of Engineering.
   

This blog copyright 2008 by jason