Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
caopu16
whatsmars
提交
254ff02f
W
whatsmars
项目概览
caopu16
/
whatsmars
与 Fork 源项目一致
Fork自
武汉红喜 / whatsmars
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
W
whatsmars
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
254ff02f
编写于
1月 16, 2018
作者:
武汉红喜
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
spring-boot-starter-activemq
上级
b9c6c5d7
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
80 addition
and
9 deletion
+80
-9
whatsmars-mq/pom.xml
whatsmars-mq/pom.xml
+9
-7
whatsmars-mq/src/main/java/org/hongxi/whatsmars/mq/activemq/boot/ActiveMQApplication.java
...ongxi/whatsmars/mq/activemq/boot/ActiveMQApplication.java
+25
-0
whatsmars-mq/src/main/java/org/hongxi/whatsmars/mq/activemq/boot/Consumer.java
.../java/org/hongxi/whatsmars/mq/activemq/boot/Consumer.java
+14
-0
whatsmars-mq/src/main/java/org/hongxi/whatsmars/mq/activemq/boot/Producer.java
.../java/org/hongxi/whatsmars/mq/activemq/boot/Producer.java
+29
-0
whatsmars-mq/src/main/java/org/hongxi/whatsmars/mq/activemq/spring/DemoMessageListener.java
...gxi/whatsmars/mq/activemq/spring/DemoMessageListener.java
+0
-1
whatsmars-mq/src/main/resources/application.yml
whatsmars-mq/src/main/resources/application.yml
+3
-1
未找到文件。
whatsmars-mq/pom.xml
浏览文件 @
254ff02f
...
...
@@ -42,17 +42,19 @@
<version>
1.1.0-RELEASE
</version>
</dependency>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-jms
</artifactId>
</dependency>
<dependency>
<groupId>
org.apache.activemq
</groupId>
<artifactId>
activemq-
client
</artifactId>
<artifactId>
activemq-
all
</artifactId>
</dependency>
<dependency>
<groupId>
org.apache.activemq
</groupId>
<artifactId>
activemq-all
</artifactId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-activemq
</artifactId>
<exclusions>
<exclusion>
<groupId>
org.apache.activemq
</groupId>
<artifactId>
activemq-broker
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
...
...
whatsmars-mq/src/main/java/org/hongxi/whatsmars/mq/activemq/boot/ActiveMQApplication.java
0 → 100644
浏览文件 @
254ff02f
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"
);
}
}
whatsmars-mq/src/main/java/org/hongxi/whatsmars/mq/activemq/boot/Consumer.java
0 → 100644
浏览文件 @
254ff02f
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
whatsmars-mq/src/main/java/org/hongxi/whatsmars/mq/activemq/boot/Producer.java
0 → 100644
浏览文件 @
254ff02f
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
whatsmars-mq/src/main/java/org/hongxi/whatsmars/mq/activemq/spring/DemoMessageListener.java
浏览文件 @
254ff02f
package
org.hongxi.whatsmars.mq.activemq.spring
;
import
org.apache.activemq.ActiveMQConnectionFactory
;
import
org.springframework.stereotype.Service
;
import
javax.jms.*
;
...
...
whatsmars-mq/src/main/resources/application.yml
浏览文件 @
254ff02f
...
...
@@ -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
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录