Created
February 27, 2020 07:05
-
-
Save forketyfork/d8fe46f8b69ca1837909c18f16fc1c38 to your computer and use it in GitHub Desktop.
XA with Spring Boot: ActiveMQ config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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