You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by bhadra <bh...@planetsoft.com> on 2010/12/15 13:57:06 UTC
MessageExchangeListener - called only first time
http=>
JMS =>
(Camel XSLT =>
DBLogger (implements MessageExchangeListener )
=>http
)
This is the components list we have
The Dblogger gets called the first time we start ServiceMix.. Second time
onewards the Listener does not get invoked at all
The messages gets transformed are sent to the HTTP endpoint but the Listener
is not called
Appreciate any help
Thanks
--
View this message in context: http://servicemix.396122.n5.nabble.com/MessageExchangeListener-called-only-first-time-tp3306210p3306210.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: MessageExchangeListener - called only first time
Posted by bhadra <bh...@planetsoft.com>.
Any one else facing the problem?
The message listener gets called only the first time I startup servicemix.
rest all of the components listed in the pipeline are called for each
message
Thanks
--
View this message in context: http://servicemix.396122.n5.nabble.com/MessageExchangeListener-called-only-first-time-tp3306210p3317558.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: MessageExchangeListener - called only first time
Posted by bhadra <bh...@planetsoft.com>.
The Camel Route:
<camelContext id="camel" errorHandlerRef="myDeadLetterChannel"
xmlns="http://camel.apache.org/schema/spring" >
<route streamCache="true">
<from uri="jbi:service:http://plosoft.com/plc/routerManuTransmit" />
<when>
<xpath>//TransactionSubType/typeValue = 1000600002</xpath>
<pipeline>
<to
uri="jbi:endpoint:http://plosoft.com/plc/xsltModifyPartyWithCd/endpoint?mep=in-out"
/>
<to uri="jbi:endpoint:http://plosoft.com/plc/jmsLogger/endpoint" />
<to
uri="jbi:endpoint:http://plosoft.com/plc/httpMEF/endpoint?mep=in-out" />
</pipeline>
</when>
<when>
<xpath>//TransactionSubType/typeValue=10006000240</xpath>
<resequence id="seq">
<xpath>//sequenceId/text()</xpath>
<convertBodyTo type="java.lang.String"></convertBodyTo>
<to uri="jbi:service:http://plosoft.com/plc/routerSplitter" />
<stream-config timeout="3000" capacity="3"/>
</resequence>
</when>
</route>
The MessageExchangeListener Implmentation is below
package com.plo.service.utilities;
import javax.annotation.Resource;
import javax.jbi.messaging.DeliveryChannel;
import javax.jbi.messaging.MessageExchange;
import javax.jbi.messaging.MessagingException;
import javax.jbi.messaging.NormalizedMessage;
import javax.xml.transform.Source;
import javax.xml.transform.TransformerException;
import com.plo.framework.ihub.logger.ILogger;
import org.apache.servicemix.jbi.jaxp.SourceTransformer;
import org.apache.servicemix.jbi.jaxp.StringSource;
import org.apache.servicemix.jbi.listener.MessageExchangeListener;
import org.apache.servicemix.jbi.helper.MessageUtil;
//import org.apache.servicemix.jbi.util.MessageUtil;
public class MessageLogger implements MessageExchangeListener {
@Resource
private DeliveryChannel channel;
ILogger logger;
// @Override
public void onMessageExchange(MessageExchange exchange)
throws MessagingException {
System.out.println("IN LOGGER" + exchange.getMessage("in"));
NormalizedMessage msg = exchange.getMessage("in");
MessageUtil.enableContentRereadability(msg);
Source content = msg.getContent();
String body = "";
try {
body = (new SourceTransformer()).toString(content);
System.out.println("body is:::::"+body);
} catch (TransformerException e) {
System.out.println("*********exception0*********"+e.getMessage());
// TODO Auto-generated catch block
e.printStackTrace();
}
msg.setContent(content);
try {
String contentStr = new
SourceTransformer().contentToString(exchange.getMessage("in"));
logger.log((new SourceTransformer()).toDOMNode(new
StringSource(contentStr)));
} catch (Exception ex) {
System.out.println("*********exception1*********"+ex.getMessage());
ex.printStackTrace();
}
try {
exchange.setMessage(msg, "out");
// exchange.setStatus(ExchangeStatus.ACTIVE);
channel.send(exchange);
} catch (Exception ex) {
System.out.println("*********exception2*********"+ex.getMessage());
}
}
private String processXml(NormalizedMessage normalizedMessage)
throws MessagingException {
SourceTransformer sourceTransformer = new SourceTransformer();
String inMessage = "";
try {
inMessage = sourceTransformer.contentToString(normalizedMessage);
} catch (Exception e) {
throw new MessagingException(e);
}
System.out.println("## In Message: " + inMessage);
return inMessage;
}
/**
* @return the logger
*/
public ILogger getLogger() {
return logger;
}
/**
* @param logger
* the logger to set
*/
public void setLogger(ILogger logger) {
this.logger = logger;
}
}
--
View this message in context: http://servicemix.396122.n5.nabble.com/MessageExchangeListener-called-only-first-time-tp3306210p3307429.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: MessageExchangeListener - called only first time
Posted by Gert Vanthienen <ge...@gmail.com>.
L.S.,
Could you mail us the Camel route that you're using, as well as the
DBLogger implementation you wrote?
Regards,
Gert Vanthienen
------------------------
FuseSource
Web: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/
On Wed, Dec 15, 2010 at 1:57 PM, bhadra <bh...@planetsoft.com> wrote:
>
>
> http=>
> JMS =>
> (Camel XSLT =>
> DBLogger (implements MessageExchangeListener )
> =>http
> )
>
> This is the components list we have
>
> The Dblogger gets called the first time we start ServiceMix.. Second time
> onewards the Listener does not get invoked at all
> The messages gets transformed are sent to the HTTP endpoint but the Listener
> is not called
>
> Appreciate any help
>
> Thanks
>
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/MessageExchangeListener-called-only-first-time-tp3306210p3306210.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>