activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lkwg82 <lkw...@gmx.de>
Subject camel and set ttl of messages
Date Thu, 10 Jul 2008 23:12:56 GMT

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.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message