From 9a8366ab3e9858dbdcd584d0238acbc1dfd78a8d Mon Sep 17 00:00:00 2001 From: lixiangrong Date: Mon, 18 Jul 2016 16:24:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mq/producer/queue/QueueSender.java | 6 +-- .../mq/producer/topic/TopicSender.java | 43 +++++++++---------- 2 files changed, 21 insertions(+), 28 deletions(-) diff --git a/src/main/java/osc/git/eh3/springamq/mq/producer/queue/QueueSender.java b/src/main/java/osc/git/eh3/springamq/mq/producer/queue/QueueSender.java index 2380a29..db6d95a 100644 --- a/src/main/java/osc/git/eh3/springamq/mq/producer/queue/QueueSender.java +++ b/src/main/java/osc/git/eh3/springamq/mq/producer/queue/QueueSender.java @@ -11,10 +11,7 @@ import javax.jms.Message; import javax.jms.Session; /** - * - * @author liang * @description 队列消息生产者,发送消息到队列 - * */ @Component("queueSender") public class QueueSender { @@ -36,5 +33,4 @@ public class QueueSender { } }); } - -} +} \ No newline at end of file diff --git a/src/main/java/osc/git/eh3/springamq/mq/producer/topic/TopicSender.java b/src/main/java/osc/git/eh3/springamq/mq/producer/topic/TopicSender.java index f4da24f..9a4e381 100644 --- a/src/main/java/osc/git/eh3/springamq/mq/producer/topic/TopicSender.java +++ b/src/main/java/osc/git/eh3/springamq/mq/producer/topic/TopicSender.java @@ -11,31 +11,28 @@ import javax.jms.Message; import javax.jms.Session; /** - * - * @author liang - * @description Topic生产者发送消息到Topic - * + * @description Topic生产者发送消息到Topic */ @Component("topicSender") public class TopicSender { - - @Autowired - @Qualifier("jmsTopicTemplate") - private JmsTemplate jmsTemplate; - - /** - * 发送一条消息到指定的队列(目标) - * @param topicName 队列名称 - * @param message 消息内容 - */ - public void send(String topicName,final String message){ - jmsTemplate.send(topicName, new MessageCreator() { - @Override - public Message createMessage(Session session) throws JMSException { - return session.createTextMessage(message); - } - }); - } -} + @Autowired + @Qualifier("jmsTopicTemplate") + private JmsTemplate jmsTemplate; + + /** + * 发送一条消息到指定的队列(目标) + * + * @param topicName 队列名称 + * @param message 消息内容 + */ + public void send(String topicName, final String message) { + jmsTemplate.send(topicName, new MessageCreator() { + @Override + public Message createMessage(Session session) throws JMSException { + return session.createTextMessage(message); + } + }); + } +} \ No newline at end of file