I am in business now. I went with the servicemix-bean. Here are the steps that I took:
1) Create servicemix service unit with Maven: mvn archetype:create -DarchetypeGroupId=org.apache.servicemix.tooling -DarchetypeArtifactId=servicemix-bean-service-unit -DarchetypeVersion=3.2.2 -DgroupId=org.apache.servicemix.samples.bridge -DartifactId=bridge-bean-su 2) Update xbean.xml generated service unit (it generates a handy MyBean example for you) and my example below calls a custom bean I have set up named 'Stash': <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:bean="http://servicemix.apache.org/bean/1.0" xmlns:b="http://servicemix.apache.org/samples/bridge" xmlns:xsi="http://http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://servicemix.apache.org/bean/1.0 http://servicemix.apache.org/schema/servicemix-bean-3.2.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean:endpoint service="b:beanService" endpoint="endpoint" bean="#myBean"/> <bean id="myBean" class="org.apache.servicemix.samples.bridge.MyBean"> <property name="stashBean"> <ref local="stash"/> </property> </bean> <bean id="stash" class="org.apache.servicemix.samples.bridge.Stash"/> </beans> 3) Update the example bean that was generate by Maven: public class MyBean implements MessageExchangeListener { @Resource private DeliveryChannel channel; //inject some bean here to do my business logic private Stash stashBean; public Stash getStashBean() { return stashBean; } public void setStashBean(Stash stashBean) { this.stashBean = stashBean; } public void onMessageExchange(MessageExchange exchange) throws MessagingException { System.out.println("Received exchange: " + exchange); //get the message out NormalizedMessage message = exchange.getMessage("in"); Source content = message.getContent(); //process content according to your logic //e.g. to access the message body as a String use String body = null; try { body = (new SourceTransformer()).toString(content); } catch (TransformerException e) { // TODO Auto-generated catch block e.printStackTrace(); } //call my function that does something stashBean.stashToRepository(body); exchange.setStatus(ExchangeStatus.DONE); channel.send(exchange); } } 4) Update the service assembly with my service unit: <dependency> <groupId>org.apache.servicemix.samples.bridge</groupId> <artifactId>bridge-bean-su</artifactId> <version>1.0-SNAPSHOT</version> </dependency> 5) Update my EIP service unit to call this, unnecessary routing removed for brevity: <?xml version="1.0"?> <beans xmlns:eip="http://servicemix.apache.org/eip/1.0" xmlns:b="http://servicemix.apache.org/samples/bridge" > <eip:static-recipient-list service="b:recipients" endpoint="endpoint"> <eip:recipients> <eip:exchange-target service="b:beanService" /> </eip:recipients> </eip:static-recipient-list> </beans> 6) Write a simple java class for stash: package org.apache.servicemix.samples.bridge; public class Stash { public void stashToRepository(String inputMessage) { System.out.println("I am going to stash some stuff right now"); System.out.println("Let me do something with this: " + inputMessage); } } 7) Run maven clean install at the project root 8) Run maven jbi:projectDeploy in the service assembly directory It should also be noted that I have an http service unit set up that maps incoming requests to the eip 'recipients' service. This was provided in the bridge example. Thanks for the assistance. The servicemix-bean component does the job. -- View this message in context: http://www.nabble.com/Connecting-POJOs-to-Service-Mix-tp20234290p20274090.html Sent from the ServiceMix - User mailing list archive at Nabble.com.
