首页>代码>spring+spring mvc+mybatis+mongodb+ActiveMQ+CXF整合小项目>/springmvc/src/main/java/com/manager/controller/JmsController.java
package com.manager.controller; import com.manager.jms.ConsumerService; import com.manager.jms.ProducerService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.TextMessage; /** * Created by static on 2017/4/10. */ @Controller @RequestMapping("/jms") public class JmsController { @Autowired private ProducerService producerService; @Autowired private ConsumerService consumerService; @Autowired private Destination queueDestination; @RequestMapping(value = "/sendJmsMsg" , method = RequestMethod.POST) public String sendJmsMsg(String msg){ producerService.sendMessage(queueDestination,msg); return "person"; } @RequestMapping(value = "getJmsMsg" , method = RequestMethod.GET) public String getJmsMsg(Model model) throws JMSException { TextMessage textMessage = consumerService.receive(queueDestination); model.addAttribute("msg",textMessage.getText()); return "person"; } }
最近下载更多
最近浏览更多
1748938504 LV2
2023年6月30日
海棠花瘦 LV9
2023年6月12日
tonghao LV18
2023年5月25日
liangge2115 LV27
2023年4月16日
代码太难了 LV11
2023年3月2日
安东尼online LV11
2023年2月15日
1481917707 LV4
2023年1月1日
tuotuo12581
2022年12月16日
暂无贡献等级
微信网友_6263159342649344 LV7
2022年12月15日
lihz151
2022年12月5日
暂无贡献等级