Fix JMS support in the CLI

Partly back port changes from affb202e and 85c95744f to 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
pull/2707/head
Stephane Nicoll 10 years ago
parent c9a3919af9
commit 9b598b49c2

@ -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)
}
}

@ -28,6 +28,7 @@ import org.springframework.boot.groovy.EnableJmsMessaging;
* {@link CompilerAutoConfiguration} for Spring JMS.
*
* @author Greg Turnquist
* @author Stephane Nicoll
*/
public class JmsCompilerAutoConfiguration extends CompilerAutoConfiguration {
@ -41,8 +42,7 @@ public class JmsCompilerAutoConfiguration extends CompilerAutoConfiguration {
@Override
public void applyDependencies(DependencyCustomizer dependencies)
throws CompilationFailedException {
dependencies.add("spring-jms", "geronimo-jms_1.1_spec");
dependencies.add("spring-jms", "jms-api");
}
@Override

@ -134,12 +134,10 @@ public class SampleIntegrationTests {
}
@Test
@Ignore("Intermittent failure on CI. See #323")
public void jmsSample() throws Exception {
String output = this.cli.run("jms.groovy");
assertTrue("Wrong output: " + output,
output.contains("Received Greetings from Spring Boot via ActiveMQ"));
FileUtils.deleteDirectory(new File("activemq-data"));// cleanup ActiveMQ cruft
output.contains("Received Greetings from Spring Boot via HornetQ"));
}
@Test

Loading…
Cancel
Save