Hi,
Spring Boot creates connectionFactory bean for you. It is named
"jmsConnectionfactory" [1]. In order to wire Camel with Spring Boot AMQ
support, you have to refer that bean from JMS component URI:
from("jms:queue?connectionFactory=#jmsConnectionfactory").to(...);
Simple as that :)
Cheers!
[1]
https://github.com/spring-projects/spring-boot/blob/90f7bc03216c709634ea7ffd3832482e25e0ace3/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQConnectionFactoryConfiguration.java#L45
sob., 5.12.2015 o 15:01 użytkownik zpyoung <[email protected]> napisał:
> Really just trying to make sure I understand how the configuration works.
> If
> I auto configure activemq with Spring Boot, I have noticed that an activemq
> component is also created in the camel context. Is Spring Boot creating
> this component or the camel context?
>
> So when I need to have a component configured differently, should I make
> the
> configuration changes on the endpoint or just create a different component?
>
> Are there really any differences between these two configurations?
>
> -----------------------------------
> create new component to handle transaction.
> @Bean
> public ActiveMQComponent activemqtx(PooledConnectionFactory
> pooledConnectionFactory) {
> ActiveMQComponent activeMQComponent = new ActiveMQComponent();
> activeMQComponent.setTransacted(true);
> activeMQComponent.setTransactionManager(new
> JmsTransactionManager(pooledConnectionFactory));
> return activeMQComponent;
> }
>
> from("activemq:TRIGGER").routeId("Trigger")
> .onException(Exception.class)
> .maximumRedeliveries(2)
> .to("activemq:EXCEPTION")
> .markRollbackOnlyLast().end()
> .transacted()
> .bean("jpaRepository")
> .to("log:out");
>
> Or just configure the enpoint.
>
> from("activemq:TRIGGER?transacted=true").routeId("Trigger")
> .onException(Exception.class)
> .maximumRedeliveries(7)
> .to("activemq:EXCEPTION")
> .markRollbackOnlyLast().end()
> .transacted()
> .bean("jpaRepository")
> .to("log:out");
>
>
> I'm guessing that creating a component allows for better reuse if you have
> several routes using the same configuration.
>
> Sample code I have been testing with
> https://github.com/zachariahyoung/docker-camel
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-and-Activemq-setup-with-Spring-Boot-tp5774544p5774728.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Henryk Konsek
http://about.me/hekonsek