I am using one program to publish messages to activemq using jms and apache camel..
public final class CamelJmsTofileExample {
private CamelJmsTofileExample() {}
public static void main(String args[]) throws Exception {
CamelContext context = new DefaultCamelContext();
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(
"vm://localhost?broker.persistent=false");
context.addComponent("test-jms",
JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
context.addRoutes(new RouteBuilder() {
public void configure() {
from("test-jms:queue:test.queue").to("file://test");
}
});
ProducerTemplate template = context.createProducerTemplate();
context.start();
for (int i = 0; i < 100; i++) {
template.sendBody("test-jms:queue:test.queue", "Test Message: " + i);
}
Thread.sleep(1000);
context.stop();
}
}
It is putting 10 message correctly...But the problem is when increasing the count of "i" to 100,500 or something i am not able to find that many messages in test folder..Help me in resolving this problem....Thanks in advance..