package com.pgf.mqspring.service.impl; import org.springframework.jms.JmsException; import org.springframework.jms.core.JmsTemplate; import org.springframework.stereotype.Service; import com.pgf.mqspring.model.SampleRequestModel; import com.pgf.mqspring.service.SampleMqSendService; @Service public class SampleMqSendServiceImpl implements SampleMqSendService{ private JmsTemplate jmsTemplate = null; private String QUE = ""; private SampleRequestModel Request = null; public SampleMqSendServiceImpl(JmsTemplate template){ this.jmsTemplate = template; } public String send() { try{ // String msg = Request.getMsg(); jmsTemplate.convertAndSend(QUE, Request); return "OK"; }catch(JmsException ex){ ex.printStackTrace(); return "FAIL"; } } public String getQUE() { return QUE; } public void setQUE(String que) { QUE = que; } public SampleRequestModel getRequest() { return Request; } public void setRequest(SampleRequestModel request) { Request = request; } }