Package com.bhle.access.jms

Source Code of com.bhle.access.jms.JmsProducerStub

package com.bhle.access.jms;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;
import javax.jms.TextMessage;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;
import org.springframework.stereotype.Component;

@Component
public class JmsProducerStub implements JmsProducer {

  @Autowired
  @Qualifier(value = "jmsProducerTemplate")
  private JmsTemplate template;

  public void send(final String text) {
    template.send(new MessageCreator() {
      public Message createMessage(Session session) throws JMSException {
        TextMessage msg = session.createTextMessage(text);
        return msg;
      }
    });
  }

}
TOP

Related Classes of com.bhle.access.jms.JmsProducerStub

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.