I just tried the example on servicemix.codehaus.org/POJO+support and works fine for me. I think that your classpath is incorrect. I just removed the reference to MessageList in MyReceiver (I couldn't find a library for it... Does anybody know where the implementation of MessageList is?

 

I’m not using MessageList in my example, but I accomplished to see the sender and receiver in action. This is part of my code:

 

 

public class MySender extends TimerTask implements ComponentLifeCycle {

    private static int gen_counter = 0;

    private ComponentContext context;

    private ObjectName extensionMBeanName;

      private static final Log log = LogFactory.getLog(MySender.class.getName());

      private Timer timer;

 

 

    /**

     * Sends a number of messages

     */

    public void sendMessages(int count) throws MessagingException {

        DeliveryChannel deliveryChannel = context.getDeliveryChannel();

        MessageExchangeFactory factory = deliveryChannel.createExchangeFactory();

 

        for (int i = 0; i < count; i++) {

            InOnly exchange = factory.createInOnlyExchange();

            NormalizedMessage message = exchange.createMessage();

            exchange.setInMessage(message);

 

            message.setProperty("id", new Integer(gen_counter));

            message.setContent(new StringSource("<example id='" + gen_counter + "'/>"));

            log.info("Message sent: " + message);

            ++gen_counter;

 

            exchange.setStatus(ExchangeStatus.DONE);

            deliveryChannel.send(exchange);

        }

    }

 

 

    public void init(ComponentContext context) throws JBIException {

        this.context = context;

        timer = new Timer();

    }

 

 

    public void start() throws JBIException {

        timer.scheduleAtFixedRate(this, 10000, 10000);

    }

 

 

    /* (non-Javadoc)

     * @see java.util.TimerTask#run()

     */

    public void run() {

        try {

            sendMessages(1);

        } catch (MessagingException e) {

            // TODO Auto-generated catch block

            e.printStackTrace();

        }       

    }

}

 

Best regards,

 

Cesar

 

 

 

 

 

Reply via email to