コード例 #1
0
 public void start() throws JMSException {
   try {
     if (!started.get()) {
       targetProducer.start();
       started.set(true);
     }
   } catch (MQClientException ex) {
     throw JMSExceptionSupport.create(ex);
   }
 }
コード例 #2
0
 @Override
 public void close() throws JMSException {
   try {
     if (started.get()) {
       targetProducer.shutdown();
       targetProducer = null;
       session.removeProducer(this);
       started.set(false);
     }
   } catch (Exception ex) {
     throw JMSExceptionSupport.create(ex);
   }
 }
コード例 #3
0
  @Override
  public void send(
      Destination destination, Message message, int deliveryMode, int priority, long timeToLive)
      throws JMSException {
    message.setJMSDestination(destination);
    com.alibaba.rocketmq.common.message.Message convertedMsg = ((MessageBase) message).convert();
    try {
      if (!started.get()) {
        targetProducer.start();
        started.set(true);
      }

      targetProducer.send(convertedMsg);
    } catch (Exception ex) {
      throw JMSExceptionSupport.create(ex);
    }
  }