1) how do I extend the following code snippet to set different TTLs on the
messages??
2) how do I print these header properties as system.println() ??

thx in advance


public final class CamelFileToJMS
{

        public static void main(String args[]) throws Exception
        {
                // START SNIPPET: e1
                CamelContext context = new DefaultCamelContext();
                // END SNIPPET: e1
                // Set up the ActiveMQ JMS Components
                // START SNIPPET: e2
                ConnectionFactory connectionFactory = new
ActiveMQConnectionFactory("tcp://localhost:61616");

                // Note we can explicity name the component
                context.addComponent("amq",
JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
                // END SNIPPET: e2
                // Add some configuration by hand ...
                // START SNIPPET: e3
                context.addRoutes(new RouteBuilder()
                {

                        @Override
                        public void configure()
                        {
                                // Anzahl der Threads, die Konsumenten sind
                                for (int i = 0; i < 10; i++)
                                {
                                        from("amq:queue:example.C").process(new 
MyProcessor());
                                }
                        }
                });
                // END SNIPPET: e3
                // Camel template - a handy class for kicking off exchanges
                // START SNIPPET: e4
                CamelTemplate template = new CamelTemplate(context);
                // END SNIPPET: e4
                // Now everything is set up - lets start the context
                context.start();
                // Now send some test text to a component - for this case a JMS 
Queue
                // The text get converted to JMS messages - and sent to the 
Queue
                // test.queue
                // The file component is listening for messages from the Queue
                // test.queue, consumes
                // them and stores them to disk. The content of each file will 
be the
                // test we sent here.
                // The listener on the file component gets notified when new 
files are
                // found ... that's it!
                // START SNIPPET: e5
                for (int i = 0; i < 10; i++)
                {
                        template.sendBody("amq:queue:example.C", "Test Message: 
" + i);
                }
        }

}

-- 
View this message in context: 
http://www.nabble.com/camel-and-set-ttl-of-messages-tp18393860p18393860.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to