I'm trying to set up a project with the stack on title, the JMS that we're using is ActiveMQ. So, here is the configuration that I'm doing:
@SpringBootApplication
public class Application {
private static Logger logger = Logger.getLogger(Application.class);
@Value("${broker.component.name}")
private String brokerComponetName;
@Value("${broker.dead.letter.queue}")
private String brokerDeadLetterQueue;
@Value("${broker.in.queue}")
private String brokerInQueue;
@Value("${broker.out.queue}")
private String brokerOutQueue;
@Value("${broker.url}")
private String brokerUrl;
@Value("${broker.user}")
private String brokerUser;
@Value("${broker.password}")
private String brokerPassword;
public static void main(String[] args) throws Exception {
logger.info("starting loader");
SpringApplication.run(Application.class, args);
}
@Bean
public SpringCamelContext camelContext(ApplicationContext applicationContext) throws Exception {
SpringCamelContext camelContext = new SpringCamelContext(applicationContext);
camelContext.addComponent(brokerComponetName, JmsComponent.jmsComponent(connectionFactory()));
camelContext.addRoutes(new RouteBuilder() {
public void configure() throws ConfigurationException {
errorHandler(deadLetterChannel(brokerDeadLetterQueue)
.onRedelivery(new FailureProcessor())
.useOriginalMessage()
.maximumRedeliveries(5)
.redeliveryDelay(5000)
.retryAttemptedLogLevel(LoggingLevel.INFO));
from(brokerInQueue)
.process(new MessageProcessor())
.to(brokerOutQueue);
}
});
return camelContext;
}
@Bean
public ConnectionFactory connectionFactory() throws ConfigurationException {
System.out.println("BROKER URL: " + brokerUrl);
return new ActiveMQConnectionFactory(brokerUser,
brokerPassword, brokerUrl);
}
I already tried to add @EnableJms to Application with no success. The stack error is the follow:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsListenerContainerFactory' defined in class path resource [org/springframework/boot/autoconfigure/jms/JmsAnnotationDrivenConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.jms.config.DefaultJmsListenerContainerFactory]: Factory method 'jmsListenerContainerFactory' threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.jms.config.DefaultJmsListenerContainerFactory.setAutoStartup(Z)V
Thank's in advanced and sorry about any mistake in question.