Comments
litl_phil wrote: While it's nice that Google and Acer share the vision of cloud-based computing, it's also worth noting that we at litl already have a webbook on the market (available at litl.com) that runs our own cloud-based OS. Unlike Chrome, litlOS is focused on creating a new and better web experience for the home, so we don't have the usual browser interface, we have our own innovative UI. In conjunction with easel mode (litl's inverted-V position) and our growing cohort of litl channels (special apps t...
Cloud Computing
Conference & Expo
November 2-4, 2009 NYC
Register Today and SAVE !..


2008 West
DIAMOND SPONSOR:
Data Direct
SOA, WOA and Cloud Computing: The New Frontier for Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
GOLD SPONSORS:
Appsense
User Environment Management – The Third Layer of the Desktop
Cordys
Cloud Computing for Business Agility
EMC
CMIS: A Multi-Vendor Proposal for a Service-Based Content Management Interoperability Standard
Freedom OSS
Practical SOA” Max Yankelevich
Intel
Architecting an Enterprise Service Router (ESR) – A Cost-Effective Way to Scale SOA Across the Enterprise
Sensedia
Return on Assests: Bringing Visibility to your SOA Strategy
Symantec
Managing Hybrid Endpoint Environments
VMWare
Game-Changing Technology for Enterprise Clouds and Applications
Click For 2008 West
Event Webcasts

2008 West
PLATINUM SPONSORS:
Appcelerator
Get ‘Rich’ Quick: Rapid Prototyping for RIA with ZERO Server Code
Keynote Systems
Designing for and Managing Performance in the New Frontier of Rich Internet Applications
GOLD SPONSORS:
ICEsoft
How Can AJAX Improve Homeland Security?
Isomorphic
Beyond Widgets: What a RIA Platform Should Offer
Oracle
REAs: Rich Enterprise Applications
Click For 2008 Event Webcasts
Everyone wants to lower their capital expenditures and increase operational efficiency - it's a sign of the times. The economy of the past 12 - 18 months has forced all organizations to do more with less and become more efficient. While everyone can identify with the request to do more with less, th...
SYS-CON.TV
SOA + EDA = Open Source ESB: ServiceMix(*)
Developing a new type of ESB

This allows you to use a plugable Marshaler to map your POJOs to JAXP Sources.

Sending Messages
This example uses a specific service to make an invocation call:

Map properties = new HashMap();
properties.put("name", "James");
// lets use a specific service to route to
QName service = new QName("http://servicemix.org/cheese/", "receiver");
EndpointResolver resolver = client.createResolverForService(service);
client.send(resolver, null, properties, "<hello>world</hello>");

In the next example, we assume that the JBI container will have set up a default routing connection for our client, so there is no requirement to specify the endpoint.

Map properties = new HashMap();
properties.put("name", "James");
client.send(null, null, properties, "<hello>world</hello>");

Invoking Services with InOut

// optional endpoint resolution
EndpointResolver resolver = client.createResolverForService(service);
Map properties = new HashMap();
properties.put("name", "James");

Object response = client.request(resolver, null, properties,
"<hello>world</hello>");

Example Using JMS and XSLT
Here's a quick example to show you some of the Service-Mix integration capabilities in action. We consume messages using JCA, then transform them with XSLT and send them to a new destination using JMS.

Let's set up a JBI component to consume from JCA using JMS:

<component id="myJmsReceiver" service="foo:myJmsReceiver"
class="org.servicemix.components.jms.JmsInUsingJCABinding"
destinationService="foo:transformer">

<property name="jcaContainer" ref="activeJcaContainer"/>

<property name="activationSpec">
  <bean class="org.activemq.ra.ActiveMQActivationSpec">
<property name="destination" value="test.org.servicemix.example.jca/>
  <property name="destinationType" value ="javax.jms.Topic"/>
  </bean>
  </property>
</component>

Let's transform the message

<component id="transformer" service="foo:trans
former" class="org.servicemix.components.xslt.XsltComponent"
destinationService="foo:transformedSender">
<property name="xsltResource" value="classpath:org/servicemix/
components/xslt/transform.xsl"/>
</component>

Now let's send the message using the Spring JmsTemplate

<component id="myJmsSender" service="foo:myJmsSender" class="org.
servicemix.components.jms.JmsSenderComponent">
<property name="template">
<bean class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory">
<ref local="jmsFactory"/>
</property>
<property name="defaultDestinationName" value="test.org.
servicemix.components.xslt.source"/>
<property name="pubSubDomain" value="true"/>
</bean>
</property>
</component>

Scripting Support
ServiceMix also supports scripting languages through JSR 223 - Scripting for Java. Here are some examples using Groovy:

Before we go into detail of how you can work with JBI and Groovy in ServiceMix, lets show a simple hello world kinda example.

<component id="myServiceUsingXMLText" service="foo:myServiceUsingXMLText"
endpoint="myServiceUsingXMLText"
class="org.servicemix.components.groovy.GroovyComponent">
  <property name="scriptText">
   <value>
    <![CDATA[

// lets output some message properties
outMessage.properties = [foo:"hello", someList:[1, 2, 3]]

// lets output some non-xml body
outMessage.bodyText = """
<hello>
  <world person="$inMessage.properties.name" location="London"/>
</hello>
"""
     ]]>
    </value>
   </property>
  </component>

As you can see the component is configured with a piece of Groovy to execute when the service is invoked.

Now we'll go through the various options which are available when working with JBI and Groovy in ServiceMix.

Maintaining State Across Requests
It's often handy to keep track of state across requests. There is a variable called 'bindings' which you can use to maintain state; here's the groovy...

if (bindings.counter == null) {
  bindings.counter = 1
}
else {
  ++bindings.counter
}

def date = new Date()

outMessage.bodyText = "<response counter='$bindings.counter'
date='$date'></response>"

About Robert Davies
Rob Davies, director of open source development at IONA, has more than 20 years of experience developing high-performance distributed enterprise systems and products for telecom and finance corporations. He is responsible for leading the development of IONA's FUSE family of open source products, which are based on leading projects at the Apache Software Foundation. Rob is a founder of the Apache ActiveMQ, Apache ServiceMix and Apache Camel projects. Prior to joining IONA, Rob served as the founder and vice president of product development at LogicBlaze, which was acquired by IONA in 2007. Previously, Rob served as founder and CTO of integration software developer SpiritSoft.

About James Strachan
James Strachan, technical director at IONA, is responsible for helping the Company provide open source offerings for organizations requiring secure, high-performance distributed systems and integration solutions. He is heavily involved in the open source community, and has co-founded several Apache projects, including ActiveMQ, Camel, Geronimo and ServiceMix. He also created the "Groovy" scripting language and additional open source projects such as dom4j, jaxen and Jelly. Prior to joining IONA, James spent more than 20 years in enterprise software development. Previously, James co-founded LogicBlaze, Inc., an enterprise open source company acquired by IONA. Prior to that, he founded SpiritSoft, Inc., a company providing enterprise Java middleware services.

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

SOA World Latest Stories
This coming Tuesday, December 8, at 2:00PM EST, SYS-CON.TV will be broadcasting live from its 4th-floor studio overlooking Times Square in New York City a very special "Power Panel" in which Cloud Computing Expo Conference Chair Jeremy Geelan and three top industry guests will be looki...
If you are like me, you are regularly receiving unsolicited email from various quarters, telling you about the latest and greatest SEO solutions on the planet. Just buy the book, or guide, or download the promotional whitepaper and this expert will offer you the latest "Secrets" to sea...
There's a lot of talk about how we need to focus on our buyers' issues and provide them educational insights to help them learn what they need to know to make buying decisions. Heck, I say it in my book...in several places, I think. I've said it on this blog, and I'll continue to say i...
This past weekend I set out explore some of the extension capabilities of Google Wave. One of the weaknesses that have been identified by many is the lack of integration with email. For me, in particular, because Wave is new, many Waves are being orphaned as those playing and testing o...
More good news for cloud computing! Google last week released its once mysterious Chrome Operating System to open source. Chrome OS, available in 2010 – is a web-based operating system that promises to boot up super-fast on a netbook – way faster than the time it takes to start your ba...
In CloudBerry Lab we are striving to make our customer service better. In this competitive market with the abundance of free offerings this is the only way to stay afloat. One of the ways to keep customers happy is to be very responsive when it comes to support request resolution. Shou...
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021


SYS-CON Featured Whitepapers
ADS BY GOOGLE