Morning all,
I've been struggling lately with the spring-boot-artemis-starter. My understanding of its spring-boot support was the following:
- set
spring.artemis.mode=embedded
and, like tomcat, spring-boot will instanciate a broker reachable through tcp (server mode). The following command should be successful:nc -zv localhost 61616
- set
spring.artmis.mode=native
and spring-boot will only configure the jms template according to thespring.artemis.*
properties (client mode).
The client mode works just fine with a standalone artemis server on my machine. Unfortunatelly, I could never manage to reach the tcp port in server mode.
I would be grateful if somebody confirms my understanding of the embedded mode.
Thank you for tour help
After some digging I noted that the implementation provided out of the box by the spring-boot-starter-artemis uses org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory
acceptor. I'm wondering if that's not the root cause (again I'm by no means an expert).
But it appears that there is a way to customize artemis configuration.
Therefore I tried the following configuration without any luck:
@SpringBootApplication
public class MyBroker {
public static void main(String[] args) throws Exception {
SpringApplication.run(MyBroker.class, args);
}
@Autowired
private ArtemisProperties artemisProperties;
@Bean
public ArtemisConfigurationCustomizer artemisConfigurationCustomizer() {
return configuration -> {
try {
configuration.addAcceptorConfiguration("netty", "tcp://localhost:" + artemisProperties.getPort());
} catch (Exception e) {
throw new RuntimeException("Failed to add netty transport acceptor to artemis instance");
}
};
}
}