I have managed to get a simple ServiceMix config sort of working:

JMS -> NMR-> Bean

My bean is hosted by the servicemix-bean component, and implements the
MessageExchangeListener interface, and also uses the @Resource annotations
to store the DeliveryChannel instance. It is deployed as part of a SA/SU,
and I can see the endpoints, queues and SA/SUs registered via MC4J.


public class CatalogServiceEngineImpl implements MessageExchangeListener {

        private static final Log log =
LogFactory.getLog(CatalogServiceEngineImpl.class);
        private ExternalCatalog catalogProvider;
        
        @Resource
        private DeliveryChannel channel;        

        public void onMessageExchange(MessageExchange exchange) throws
MessagingException 
        {
                if (exchange.getStatus() == ExchangeStatus.ACTIVE) 
                {
                        log.info("Received message " + exchange);
                        NormalizedMessage message = exchange.getMessage("in");
                        ExchangeStatus outgoingStatus = ExchangeStatus.DONE;
                        
                        log.info("About to get operation id ");
                        Integer operationId = (Integer) 
message.getProperty("operationId");
                        log.info("Checking operation Id ");
                        
                        if (operationId != null)
                        {
                                log.info("OperationId= " + operationId);
                        }
                        
                        exchange.setStatus(outgoingStatus);
                        channel.send(exchange);
                }
        }
}
        
I am trying to invoke the Bean service through a JMSClient (taken from 
loans-broker-bpel), with a simple message that has only one property called
operationId.

However, i get the following stack trace:

ERROR - MultiplexingConsumerProcessor  - Error while handling jms message
java.lang.NullPointerException
        at
org.apache.servicemix.jms.AbstractJmsProcessor.toNMS(AbstractJmsProce
ssor.java:172)
        at
org.apache.servicemix.jms.multiplexing.MultiplexingConsumerProcessor.
access$300(MultiplexingConsumerProcessor.java:40)
        at
org.apache.servicemix.jms.multiplexing.MultiplexingConsumerProcessor$
1.run(MultiplexingConsumerProcessor.java:93)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
ker.runTask(ThreadPoolExecutor.java:665)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
ker.run(ThreadPoolExecutor.java:690)
        at java.lang.Thread.run(Thread.java:595)

Any ideas?

-- 
View this message in context: 
http://www.nabble.com/Usage-of-lightweight-components--tf3325766s12049.html#a11769691
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to