I have created a pojo bean that I want to use to process an in bound message & save it as a record in a database. Right now my basic flow is: file poller >> xpath splitter >> pojo db writer >> aggregator to create done file. There's a wiretap in there between the splitter & the pojo db writer to catch error messages.
The basic problem right now is that I am stuck on how to get the message to pass from the db writer to the aggregator (or any other processing I might want to do after that.) Here's my chunk of xbean.xml that I have used to configure the pojo: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:bean="http://servicemix.apache.org/bean/1.0" xmlns:aries="urn:aries:monitor" 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="aries:dbwriter" endpoint="endpoint" bean="#dbwriter"/> <bean id="dbwriter" class="com.bigideas.aries.monitor.DbWriter"> <property name="dataSource" ref="dataSource" /> </bean> <bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql://localhost/aries"/> <property name="username" value="xxxx"/> <property name="password" value="xxxx"/> </bean> </beans> Then I basically have the same pojo from the example: public class DbWriter implements MessageExchangeListener { SimpleJdbcTemplate template; @Resource private DeliveryChannel channel; public void onMessageExchange(MessageExchange exchange) throws MessagingException { System.out.println("Received exchange: " + exchange); this.writeMessage(exchange.toString()); exchange.setStatus(ExchangeStatus.DONE); //aggregator.send(MessageUtil.copyOut(exchange)); //exchange.setMessage(MessageUtil., arg1) //MessageUtil.transferInToOut(exchange, exchange); channel.send(exchange); } private void writeMessage(String msg){ this.template.update("INSERT INTO message (message) VALUES(?)", new Object[]{msg}); } public void setDataSource(DataSource ds){ this.template = new SimpleJdbcTemplate(ds); } } So basically if I try to comment out the line that sets the status to done & then use the transferInToOut I get an error that each message is InOnly. So how do I configure the pojo to be InOut, do I have to use the alternate configuration servicmix.xml file or can that still be accomplished using the xbean.xml configuration. -- View this message in context: http://www.nabble.com/servicemix-bean-tp19579004p19579004.html Sent from the ServiceMix - User mailing list archive at Nabble.com.
