Fix JMS support in the CLI
Partly back port changes fromaffb202eand85c95744fto fix the usage of JMS in the CLI. Restore the integration test using HornetQ and fix the coordinates of the JMS API. Fixes gh-2075
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
package org.test
|
||||
|
||||
@Grab("org.apache.activemq:activemq-all:5.4.0")
|
||||
@Grab("activemq-pool")
|
||||
@Grab("spring-boot-starter-hornetq")
|
||||
@Grab("hornetq-jms-server")
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import org.hornetq.jms.server.config.impl.JMSQueueConfigurationImpl
|
||||
|
||||
@Log
|
||||
@Configuration
|
||||
@@ -19,7 +20,6 @@ class JmsExample implements CommandLineRunner {
|
||||
new DefaultMessageListenerContainer([
|
||||
connectionFactory: connectionFactory,
|
||||
destinationName: "spring-boot",
|
||||
pubSubDomain: true,
|
||||
messageListener: new MessageListenerAdapter(new Receiver(latch:latch)) {{
|
||||
defaultListenerMethod = "receive"
|
||||
}}
|
||||
@@ -28,7 +28,7 @@ class JmsExample implements CommandLineRunner {
|
||||
|
||||
void run(String... args) {
|
||||
def messageCreator = { session ->
|
||||
session.createObjectMessage("Greetings from Spring Boot via ActiveMQ")
|
||||
session.createObjectMessage("Greetings from Spring Boot via HornetQ")
|
||||
} as MessageCreator
|
||||
log.info "Sending JMS message..."
|
||||
jmsTemplate.send("spring-boot", messageCreator)
|
||||
@@ -44,4 +44,9 @@ class Receiver {
|
||||
log.info "Received ${message}"
|
||||
latch.countDown()
|
||||
}
|
||||
|
||||
@Bean JMSQueueConfigurationImpl springBootQueue() {
|
||||
new JMSQueueConfigurationImpl('spring-boot', null, false)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user