diff --git a/whatsmars-mq/pom.xml b/whatsmars-mq/pom.xml
index 28dcf40be1b9bffa8a2e93409a1bb54b0ea77117..38947291e8a74e9fde53410db714ce32fb556b0d 100644
--- a/whatsmars-mq/pom.xml
+++ b/whatsmars-mq/pom.xml
@@ -42,17 +42,19 @@
1.1.0-RELEASE
-
- org.springframework
- spring-jms
-
org.apache.activemq
- activemq-client
+ activemq-all
- org.apache.activemq
- activemq-all
+ org.springframework.boot
+ spring-boot-starter-activemq
+
+
+ org.apache.activemq
+ activemq-broker
+
+
diff --git a/whatsmars-mq/src/main/java/org/hongxi/whatsmars/mq/activemq/boot/ActiveMQApplication.java b/whatsmars-mq/src/main/java/org/hongxi/whatsmars/mq/activemq/boot/ActiveMQApplication.java
new file mode 100644
index 0000000000000000000000000000000000000000..b31a97a976ffb0ce11bfd2d1af0c4b23c88e7c8a
--- /dev/null
+++ b/whatsmars-mq/src/main/java/org/hongxi/whatsmars/mq/activemq/boot/ActiveMQApplication.java
@@ -0,0 +1,25 @@
+package org.hongxi.whatsmars.mq.activemq.boot;
+
+import org.apache.activemq.command.ActiveMQQueue;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Bean;
+import org.springframework.jms.annotation.EnableJms;
+
+import javax.jms.Queue;
+
+/**
+ * Created by shenhongxi on 2018/1/16.
+ */
+@SpringBootApplication
+@EnableJms
+public class ActiveMQApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(ActiveMQApplication.class);
+ }
+
+ @Bean
+ public Queue queue() {
+ return new ActiveMQQueue("sample.queue");
+ }
+}
diff --git a/whatsmars-mq/src/main/java/org/hongxi/whatsmars/mq/activemq/boot/Consumer.java b/whatsmars-mq/src/main/java/org/hongxi/whatsmars/mq/activemq/boot/Consumer.java
new file mode 100644
index 0000000000000000000000000000000000000000..cc24886ab4fa71ec440a2daba6772396547bef4e
--- /dev/null
+++ b/whatsmars-mq/src/main/java/org/hongxi/whatsmars/mq/activemq/boot/Consumer.java
@@ -0,0 +1,14 @@
+package org.hongxi.whatsmars.mq.activemq.boot;
+
+import org.springframework.jms.annotation.JmsListener;
+import org.springframework.stereotype.Component;
+
+@Component
+public class Consumer {
+
+ @JmsListener(destination = "sample.queue")
+ public void receiveQueue(String text) {
+ System.out.println(text);
+ }
+
+}
\ No newline at end of file
diff --git a/whatsmars-mq/src/main/java/org/hongxi/whatsmars/mq/activemq/boot/Producer.java b/whatsmars-mq/src/main/java/org/hongxi/whatsmars/mq/activemq/boot/Producer.java
new file mode 100644
index 0000000000000000000000000000000000000000..1a9d0a40bcf3b20db1886926ca28f3b6b43c8fd0
--- /dev/null
+++ b/whatsmars-mq/src/main/java/org/hongxi/whatsmars/mq/activemq/boot/Producer.java
@@ -0,0 +1,29 @@
+package org.hongxi.whatsmars.mq.activemq.boot;
+
+import javax.jms.Queue;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.jms.core.JmsMessagingTemplate;
+import org.springframework.stereotype.Component;
+
+@Component
+public class Producer implements CommandLineRunner {
+
+ @Autowired
+ private JmsMessagingTemplate jmsMessagingTemplate;
+
+ @Autowired
+ private Queue queue;
+
+ @Override
+ public void run(String... args) throws Exception {
+ send("Sample message");
+ System.out.println("Message was sent to the Queue");
+ }
+
+ public void send(String msg) {
+ this.jmsMessagingTemplate.convertAndSend(this.queue, msg);
+ }
+
+}
\ No newline at end of file
diff --git a/whatsmars-mq/src/main/java/org/hongxi/whatsmars/mq/activemq/spring/DemoMessageListener.java b/whatsmars-mq/src/main/java/org/hongxi/whatsmars/mq/activemq/spring/DemoMessageListener.java
index 26cb1ef9de34ec23eb212bf9f159d13bd70a9cfa..0a91642def3f8fa697323655fc06d171e03b3f8d 100644
--- a/whatsmars-mq/src/main/java/org/hongxi/whatsmars/mq/activemq/spring/DemoMessageListener.java
+++ b/whatsmars-mq/src/main/java/org/hongxi/whatsmars/mq/activemq/spring/DemoMessageListener.java
@@ -1,6 +1,5 @@
package org.hongxi.whatsmars.mq.activemq.spring;
-import org.apache.activemq.ActiveMQConnectionFactory;
import org.springframework.stereotype.Service;
import javax.jms.*;
diff --git a/whatsmars-mq/src/main/resources/application.yml b/whatsmars-mq/src/main/resources/application.yml
index 6ef9d5d837ac4076e81872db069ebdfcf8c79230..0a54ec9848fe177dd6dbdf4399dc9d70ffb624f1 100644
--- a/whatsmars-mq/src/main/resources/application.yml
+++ b/whatsmars-mq/src/main/resources/application.yml
@@ -2,4 +2,6 @@ spring:
rocketmq:
name-server: 127.0.0.1:9876
producer:
- group: boot_producer_group
\ No newline at end of file
+ group: boot_producer_group
+ activemq:
+ brokerUrl: tcp://127.0.0.1:61616
\ No newline at end of file