Java Code Examples for org.apache.camel.component.jms.JmsComponent#setConnectionFactory()
The following examples show how to use
org.apache.camel.component.jms.JmsComponent#setConnectionFactory() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JmsComponentProducer.java From wildfly-camel-examples with Apache License 2.0 | 5 votes |
@Produces @Named("jms") public JmsComponent createJmsComponent() { JmsComponent component = new JmsComponent(); component.setConnectionFactory(connectionFactory); return component; }
Example 2
Source File: JmsRouteBuilder.java From wildfly-camel-examples with Apache License 2.0 | 5 votes |
@Override public void configure() throws Exception { /** * Configure the JMSComponent to use the connection factory * injected into this class */ JmsComponent component = new JmsComponent(); component.setConnectionFactory(connectionFactory); getContext().addComponent("jms", component); /** * This route uses the timer component to generate a message which is sent to * the JMS OrdersQueue */ from("timer:produceJMSMessage?period=5s&delay=0&fixedRate=true") .process(new Processor() { @Override public void process(Exchange exchange) throws Exception { Integer count = exchange.getProperty(Exchange.TIMER_COUNTER, Integer.class); Date date = exchange.getProperty(Exchange.TIMER_FIRED_TIME, Date.class); exchange.getOut().setBody(String.format("Message %d created at %s", count, date.toString())); } }) .to("jms:queue:OrdersQueue"); /** * This route is invoked by the {@link MessageDrivenBean} message consumer and outputs * the message payload to the console log */ from("direct:jmsIn") .log("Received message: ${body}"); }