My MessageReceiver code :
public class MessageReceiverImpl extends ComponentSupport implements
MessageExchangeListener,MessageReceiver{
// log
private Log log =
LogFactory.getLog(MessageReceiverImpl.class);
// sourcetransformer to transform message from exchange
private SourceTransformer sourceTransformer = new
SourceTransformer();
public Log getLog() {
return log;
}
public void setLog(Log log) {
this.log = log;
}
public SourceTransformer getSourceTransformer() {
return sourceTransformer;
}
public void setSourceTransformer(SourceTransformer
sourceTransformer) {
this.sourceTransformer = sourceTransformer;
}
/**
* This method will get the Asynchronous messages from
exchange, will transform into Java Bean and then
* call another class method to store into db.
* @return void
* @param args MessageExchange exchange to get messages
*/
public void onMessageExchange(MessageExchange exchange) throws
MessagingException {
// getting the incoming message from exchange
NormalizedMessage message = exchange.getMessage("in");
if (message == null) {
log.warn("Received null message from exchange: " +
exchange);
}
else {
log.info("Exchange: " + exchange + " received IN
message : " + message);
try {
// getting the messaging content from message in
xml format
String xml =
sourceTransformer.toString(message.getContent());
// using the custom utility class to transform
xml into java object
Message messageBean =
XMLBeanUtil.getMessageObjectFromXML(xml);
// saving that java object into database by using
the hibernate
MessagesDAOImpl instance = new MessagesDAOImpl();
instance.saveMessage(messageBean);
}
catch (TransformerException e) {
log.error("Failed to turn message body into text: "
+ e, e);
}
catch(Exception e) {
log.error("Failed to turn message body into
text: " + e, e);
}
}
// done with exchange
done(exchange);
}
}
--
View this message in context:
http://www.nabble.com/error-in-endpoint-generation-t1630736.html#a4431780
Sent from the ServiceMix - User forum at Nabble.com.