Skip to content

Instantly share code, notes, and snippets.

@forketyfork
Created February 27, 2020 07:05
Show Gist options
  • Save forketyfork/d8fe46f8b69ca1837909c18f16fc1c38 to your computer and use it in GitHub Desktop.
Save forketyfork/d8fe46f8b69ca1837909c18f16fc1c38 to your computer and use it in GitHub Desktop.
XA with Spring Boot: ActiveMQ config
@Configuration
public class ActiveMQConfig {
@Bean("activemq")
public ActiveMQComponent activeMq(
ConnectionFactory connectionFactory,
JtaTransactionManager jtaTransactionManager) {
ActiveMQComponent component = new ActiveMQComponent();
component.setAcknowledgementMode(JmsProperties.AcknowledgeMode.CLIENT.getMode());
component.setCacheLevelName("CACHE_CONSUMER");
component.setConnectionFactory(connectionFactory);
component.setTransacted(true);
component.setTransactionManager(jtaTransactionManager);
return component;
}
@Bean
public ActiveMQConnectionFactoryCustomizer activeMQConnectionFactoryCustomizer() {
return factory -> {
RedeliveryPolicy policy = new RedeliveryPolicy();
policy.setRedeliveryDelay(1000);
policy.setMaximumRedeliveries(2);
factory.setRedeliveryPolicy(policy);
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment