The current petals ESB snapshot comes with a new feature : A new command line interface.
This interface uses the petals ESB Web services which are now embedded within the container. There is no launcher for the CLI right now but it should come soon. For now, here are some snippets :
Connecting to http://localhost:7600/petals/ws ...
PEtALS CLI. Tape 'help' for help.
/> h
PEtALS prompt usage:
- a, addart Upload an artifact to the petals server
- c, connect Connects the client to a petals server
- e, endpoint Displays the list of endpoints
- i, info Displays the container information
- ic, install Deals with the component installation and uninstallation
- j, jbiart Displays the list of JBI artefacts
- q, stop Stops the container
- r, repo Displays the petals repository content
- t, topology Displays the petals topology
- x, shutdown Shutdown the container
/>
Jacobo Matute from TheServerLabs wrote a very good tutorial on its blog about developping a SCA based application using JBI and especially using PEtALS SCA features. You can find the article here.
The PEtALS Architecture document I wrote last winter has just been published. You can get it from the OW2 PEtALS web site or read from my slideshare account.
This is quite the same thing than the previous post where I introduced how to expose JAXWS service in PEtALS ESB with Maven. This time, let’s proxify a Web service in PEtALS with Maven.
Since I am always using command line tools such as Maven or Ant to create my project and to package them, I have just created a new Maven plugin to easily and quickly expose a JAXWS service in PEtALS with Maven. This plugin will generate the JBI Service Unit and Service Assembly from a Maven java project with just a few lines of Maven settings…
As an example, the following interface :
packageorg.ow2.petals;importjavax.jws.WebMethod;importjavax.jws.WebService;
@WebService
publicinterface Service {
@WebMethod
String ping(String input);}
and its implementation :
packageorg.ow2.petals;publicclass ServiceImpl implements Service {publicString ping(String input){return input;}}
will generate a Service Assembly idirectly deployable to PEtALS by the help of the Maven plugin :
This news has not been published on the PEtALS Web Site (why?) but yes we now have some SCA (Service Component Architecture) tools available with PEtALS ESB!
This work is a result of the ScorWare project in which eBM WebSourcing was involved in.
The main advantage of SCA over other approaches, like BPEL or EIP, is that you can define the composition with Java instead of XML. The SCA composite defines services, which are exposed in the bus. It also defines references, which point to services that might be called or used by the composite at runtime. These references define possible dependencies. And eventually, your composite embeds a Java implementation which allows you to manipulate the references as simple Java objects. This makes the user job easier, in particular to call a service operation or test conditions on a service call result.
For more details on SCA, on tools and more, take a look at the links below :
SCA is a specification defined by the Open SOA consortium.
SCA is in standardization process by the OASIS Consortium.
OW2 FraSCAti is the SCA platform the SCA service engine is based on.
Eclipse SCA Tools exist and are hosted by the SOA Tools Platform project. They can be used with the SCA service engine.
PEtALS Eclipse tools complete the STP SCA tools for PEtALS specifics (PEtALS Maven plug-in support, packaging for PEtALS…).
The current article will show you that the JSR181 Service Engine really provides an easy way to create JBI services. Since creating simple HelloWorld service is quite boring, let’s talk to twitter micro blogging site.
I will use the Twitter4J API () to talk to Twitter (right all the Twitter job is done here… The current article is not a Twitter tutorial but just a small PEtALS one…).
packagenet.chamerling.petals.twitter;importjava.util.ArrayList;importjava.util.List;importjavax.jws.WebMethod;importjavax.jws.WebParam;importjavax.jws.WebService;importtwitter4j.Status;importtwitter4j.Twitter;importtwitter4j.TwitterException;/**
* @author chamerling
*
*/
@WebService(serviceName ="TwitterService", name ="TwitterService", targetNamespace ="http://twitter.chamerling.net/petals")publicclass TwitterServiceImpl implements TwitterService {/*
* (non-Javadoc)
* @see net.chamerling.petals.twitter.TwitterService#update(java.lang.String, java.lang.String, java.lang.String)
*/
@WebMethod
publicString update(@WebParam(name ="id")String login,
@WebParam(name ="password")String password,
@WebParam(name ="status")String status)throws TwitterServiceException {String result =null;try{
Status s = getTwitter(login, password).update(status);
result = s.getText();}catch(twitter4j.TwitterException e){thrownew TwitterServiceException(e.getMessage());}return result;}/*
* (non-Javadoc)
* @see net.chamerling.petals.twitter.TwitterService#getTimeLine(java.lang.String, java.lang.String, java.lang.String)
*/
@WebMethod
publicString[] getTimeLine(@WebParam(name ="id")String login,
@WebParam(name ="password")String password,
@WebParam(name ="user")String user)throws TwitterServiceException {
Twitter twitter = getTwitter(login, password);List result =newArrayList();List status =null;try{if(user ==null){
status = twitter.getUserTimeline();}else{
status = twitter.getUserTimeline(user);}}catch(TwitterException e){thrownew TwitterServiceException(e.getMessage());}for(Status status2 : status){
result.add(status2.getText());}return result.toArray(newString[0]);}/**
* TODO : Some work to do for caching...
*
* @param login
* @param password
* @return
*/private Twitter getTwitter(String login, String password){returnnew Twitter(login, password);}}
Put all of this in a JSR181 Service Unit, ie create the good Service Unit descriptor (cf to source attchment), package it (use PEtALS Maven plugin) and that’s all. JSR181 makes it easy ;o)
So now you can publish some status to Twitter with PEtALS.
I have created a test acount here http://twitter.com/chamerlingtest on which I have published messages with PEtALS.
Next week at the SOA4All project first year review (Brussels NESSI office), I will show a prototype of the SOA4All Distributed Service Bus based on PEtALS ESB and on a P2P based library.
Like in every middleware demo, it is always difficult to show something ’sexy’ since exchanging XML messages is not… This time I have a web portal based on GWT which is connected to the Bus which is more funky. The main point is how message are exchanged between PEtALS nodes with P2P and semantic techniques. I think this feature will be available in PEtALS before the end of the project (year 2011), so stay tuned.
The Dragon SOA Governance solution (http://dragon.ow2.org) has just been released. Dragon is a high performance SOA Governance solution. It allows you organize, enforce and reconfigure your Service Oriented infrastructure.
There are a lot of cool features and as you can see in the following figure and one of the main goals is to connect Dragon to existing SOA platforms such as PEtALS ESB (http://petals.ow2.org).
I have worked with the Olivier (the Dragon product leader) to define the connector API and I have implemented it on the PEtALS side.
I hope publish a PEtALS snapshot this month wich will be connected to Dragon… Stay tuned !
Here are some slides extracted from a SOA4All presentation I gave last month in a technical meeting. It introduces the distributed aspects of PEtALS and also give some deployment and orchestration samples.