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.service.SampleMqReceiveService; @Service public class SampleMqReceiveServiceImpl implements SampleMqReceiveService{ private JmsTemplate jmsTemplate = null; private String QUE = ""; public SampleMqReceiveServiceImpl(JmsTemplate template){ this.jmsTemplate = template; } public String receive(){ try{ return jmsTemplate.receiveAndConvert(QUE).toString(); }catch(JmsException ex){ ex.printStackTrace(); return "FAIL"; } } public String getQUE() { return QUE; } public void setQUE(String que) { QUE = que; } }