I have written a Spring Boot application which aims to push and consume a message from JBoss Wildfly 10 ActiveMQ Artemis (NOTE: not Apache ActiveMQ 5.x). I am running this code through Spring Tool Suite.
I have also setup JBoss Wildfly 10 on my local system (on 8080 port) and have run the same in standalone-full.xml
profile in order to create a queue called TestQ
in the messaging subsystems of Wildfly.
Next I used JMSTemplate
in the Spring Boot code for pushing and consuming the message in the above mentioned queue with the following things in application.properties
:
spring.activemq.username=admin
spring.activemq.username=admin
spring.activemq.broker-url=http://localhost:8080
However, I am getting Could not send message
error while running my code.
Can you please suggest what changes would be required?
My basic aim is to push and consume message from this external queue using Spring Boot.
I have tried alternatives on the net, but every example I get is for Apache ActiveMQ and not ActiveMQ Artemis embedded into JBoss Wildfly which is required.
I have the below 2 classes:
1.
@SpringBootApplication
@EnableJms
public class App {
@Bean
public JmsListenerContainerFactory<?> myFactory(ConnectionFactory connectionFactory,
DefaultJmsListenerContainerFactoryConfigurer configurer) {
DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
configurer.configure(factory, connectionFactory);
return factory;
}
public static void main(String[] args) {
// Launch the application
ConfigurableApplicationContext context = SpringApplication.run(App.class, args);
JmsTemplate jmsTemplate = context.getBean(JmsTemplate.class);
System.out.println("Sending a JMS message.");
jmsTemplate.convertAndSend("sampleQueue", "Hello world!");
}
}
2.
@Component
public class ReceiveMessage {
@JmsListener(destination = "sampleQueue")
public void receiveMessage(String msg) {
System.out.println("Received :" + msg);
}
}
org.apache.activemq.artemis
logging to DEBUG (on both client and server, if different hosts/different WildFly applications), recycle the app servers, and re-run some end-to-end tests. This is probably the fastest/most effective way to determine 1) who's failing, and 2) what exactly is the failure – paulsm4