當前位置: 首頁>>代碼示例>>Java>>正文


Java DeliveryMode.NON_PERSISTENT屬性代碼示例

本文整理匯總了Java中javax.jms.DeliveryMode.NON_PERSISTENT屬性的典型用法代碼示例。如果您正苦於以下問題:Java DeliveryMode.NON_PERSISTENT屬性的具體用法?Java DeliveryMode.NON_PERSISTENT怎麽用?Java DeliveryMode.NON_PERSISTENT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在javax.jms.DeliveryMode的用法示例。


在下文中一共展示了DeliveryMode.NON_PERSISTENT屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setUp

/**
 * Sets a test to have a queue destination and non-persistent delivery mode.
 *
 * @see junit.framework.TestCase#setUp()
 */
@Override
protected void setUp() throws Exception {
   deliveryMode = DeliveryMode.NON_PERSISTENT;
   topic = false;
   super.setUp();
   consumerDestination2 = consumeSession.createTopic("FOO.BAR.HUMBUG2");
   LOG.info("Created  consumer destination: " + consumerDestination2 + " of type: " + consumerDestination2.getClass());
   if (durable) {
      LOG.info("Creating durable consumer");
      consumer2 = consumeSession.createDurableSubscriber((Topic) consumerDestination2, getName());
   } else {
      consumer2 = consumeSession.createConsumer(consumerDestination2);
   }

}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:20,代碼來源:JmsQueueTopicCompositeSendReceiveTest.java

示例2: setDeliveryMode

@Override
public JMSProducer setDeliveryMode(int deliveryMode) {
    switch (deliveryMode) {
        case DeliveryMode.PERSISTENT:
        case DeliveryMode.NON_PERSISTENT:
            this.deliveryMode = deliveryMode;
            return this;
        default:
            throw new JMSRuntimeException(String.format("Invalid DeliveryMode specified: %d", deliveryMode));
    }
}
 
開發者ID:messaginghub,項目名稱:pooled-jms,代碼行數:11,代碼來源:JmsPoolJMSProducer.java

示例3: setJMSDeliveryMode

@Override
public void setJMSDeliveryMode(int deliveryMode) throws JMSException {
    switch (deliveryMode) {
        case DeliveryMode.PERSISTENT:
            persistent = true;
            break;
        case DeliveryMode.NON_PERSISTENT:
            persistent = false;
            break;
        default:
            throw new JMSException(String.format("Invalid DeliveryMode specific: %d", deliveryMode));
    }
}
 
開發者ID:messaginghub,項目名稱:pooled-jms,代碼行數:13,代碼來源:MockJMSMessage.java

示例4: setDeliveryMode

@Override
public void setDeliveryMode(int deliveryMode) throws JMSException {
    checkClosed();
    switch (deliveryMode) {
        case DeliveryMode.PERSISTENT:
        case DeliveryMode.NON_PERSISTENT:
            this.deliveryMode = deliveryMode;
            break;
        default:
            throw new JMSException(String.format("Invalid DeliveryMode specified: %d", deliveryMode));
    }
}
 
開發者ID:messaginghub,項目名稱:pooled-jms,代碼行數:12,代碼來源:MockJMSMessageProducer.java

示例5: getDeliveryMode

private int getDeliveryMode() {
    if (persistentDelivery) {
        return DeliveryMode.PERSISTENT;
    }

    return DeliveryMode.NON_PERSISTENT;
}
 
開發者ID:apache,項目名稱:bahir-flink,代碼行數:7,代碼來源:AMQSink.java

示例6: setJMSDeliveryMode

@Override
public void setJMSDeliveryMode(final int deliveryMode) throws JMSException {
   if (deliveryMode == DeliveryMode.PERSISTENT) {
      message.setDurable(true);
   } else if (deliveryMode == DeliveryMode.NON_PERSISTENT) {
      message.setDurable(false);
   } else {
      throw ActiveMQJMSClientBundle.BUNDLE.illegalDeliveryMode(deliveryMode);
   }
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:10,代碼來源:ActiveMQMessage.java

示例7: setJMSDeliveryMode

@Override
public final void setJMSDeliveryMode(int deliveryMode) throws JMSException {
   if (deliveryMode == DeliveryMode.PERSISTENT) {
      message.setDurable(true);
   } else if (deliveryMode == DeliveryMode.NON_PERSISTENT) {
      message.setDurable(false);
   } else {
      throw new JMSException("Invalid mode " + deliveryMode);
   }
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:10,代碼來源:ServerJMSMessage.java

示例8: set

@Override
public void set(Message message, Object value) throws MessageFormatException {
    Integer rc = (Integer) TypeConversionSupport.convert(value, Integer.class);
    if (rc == null) {
        Boolean bool = (Boolean) TypeConversionSupport.convert(value, Boolean.class);
        if (bool == null) {
            throw new MessageFormatException("Property JMSDeliveryMode cannot be set from a " + value.getClass().getName() + ".");
        }
        else {
            rc = bool.booleanValue() ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT;
        }
    }
    ((ActiveMQMessage) message).setJMSDeliveryMode(rc);
}
 
開發者ID:DiamondLightSource,項目名稱:daq-eclipse,代碼行數:14,代碼來源:ActiveMQMessage.java

示例9: setDeliveryMode

@Override
public void setDeliveryMode(final int deliveryMode) throws JMSException {
   checkClosed();
   if (deliveryMode != DeliveryMode.NON_PERSISTENT && deliveryMode != DeliveryMode.PERSISTENT) {
      throw ActiveMQJMSClientBundle.BUNDLE.illegalDeliveryMode(deliveryMode);
   }

   defaultDeliveryMode = deliveryMode;
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:9,代碼來源:ActiveMQMessageProducer.java

示例10: setUp

/**
 * Sets a test to have a queue destination and non-persistent delivery mode.
 *
 * @see junit.framework.TestCase#setUp()
 */
@Override
protected void setUp() throws Exception {
   topic = false;
   deliveryMode = DeliveryMode.NON_PERSISTENT;
   super.setUp();
   ActiveMQDestination dest1 = (ActiveMQDestination) session.createQueue("FOO.BAR.HUMBUG2");
   ActiveMQDestination dest2 = (ActiveMQDestination) session.createQueue("TEST");
   ArtemisBrokerHelper.makeSureDestinationExists(dest1);
   ArtemisBrokerHelper.makeSureDestinationExists(dest2);
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:15,代碼來源:JmsQueueCompositeSendReceiveTest.java

示例11: setUp

/**
 * Sets a test to have a queue destination and non-persistent delivery mode.
 *
 * @see junit.framework.TestCase#setUp()
 */
@Override
protected void setUp() throws Exception {
   deliveryMode = DeliveryMode.NON_PERSISTENT;
   super.setUp();
   consumerDestination2 = consumeSession.createTopic("FOO.BAR.HUMBUG2");
   LOG.info("Created  consumer destination: " + consumerDestination2 + " of type: " + consumerDestination2.getClass());
   if (durable) {
      LOG.info("Creating durable consumer");
      consumer2 = consumeSession.createDurableSubscriber((Topic) consumerDestination2, getName());
   } else {
      consumer2 = consumeSession.createConsumer(consumerDestination2);
   }

}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:19,代碼來源:JmsTopicCompositeSendReceiveTest.java

示例12: setUp

@Override
protected void setUp() throws Exception {
   topic = true;
   durable = false;
   deliveryMode = DeliveryMode.NON_PERSISTENT;
   super.setUp();
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:7,代碼來源:JmsTopicWildcardSendReceiveTest.java

示例13: setUp

/**
 * Sets a test to have a queue destination and non-persistent delivery mode.
 *
 * @see junit.framework.TestCase#setUp()
 */
@Override
protected void setUp() throws Exception {
   topic = false;
   deliveryMode = DeliveryMode.NON_PERSISTENT;
   super.setUp();
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:11,代碼來源:JmsQueueWildcardSendReceiveTest.java

示例14: getJMSDeliveryMode

@Override
public int getJMSDeliveryMode() throws JMSException {
    return persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT;
}
 
開發者ID:messaginghub,項目名稱:pooled-jms,代碼行數:4,代碼來源:MockJMSMessage.java

示例15: configure

/**
 * Configure this class.
 * 
 * @param props initial configuration
 *
 * @throws ConnectException   Operation failed and connector should stop.
 */
public void configure(Map<String, String> props) {
    String queueManager = props.get(MQSinkConnector.CONFIG_NAME_MQ_QUEUE_MANAGER);
    String connectionNameList = props.get(MQSinkConnector.CONFIG_NAME_MQ_CONNECTION_NAME_LIST);
    String channelName = props.get(MQSinkConnector.CONFIG_NAME_MQ_CHANNEL_NAME);
    String queueName = props.get(MQSinkConnector.CONFIG_NAME_MQ_QUEUE);
    String userName = props.get(MQSinkConnector.CONFIG_NAME_MQ_USER_NAME);
    String password = props.get(MQSinkConnector.CONFIG_NAME_MQ_PASSWORD);
    String builderClass = props.get(MQSinkConnector.CONFIG_NAME_MQ_MESSAGE_BUILDER);
    String mbj = props.get(MQSinkConnector.CONFIG_NAME_MQ_MESSAGE_BODY_JMS);
    String timeToLive = props.get(MQSinkConnector.CONFIG_NAME_MQ_TIME_TO_LIVE);
    String persistent = props.get(MQSinkConnector.CONFIG_NAME_MQ_PERSISTENT);
    String sslCipherSuite = props.get(MQSinkConnector.CONFIG_NAME_MQ_SSL_CIPHER_SUITE);
    String sslPeerName = props.get(MQSinkConnector.CONFIG_NAME_MQ_SSL_PEER_NAME);

    try {
        mqConnFactory = new MQConnectionFactory();
        mqConnFactory.setTransportType(WMQConstants.WMQ_CM_CLIENT);
        mqConnFactory.setQueueManager(queueManager);
        mqConnFactory.setConnectionNameList(connectionNameList);
        mqConnFactory.setChannel(channelName);

        queue = new MQQueue(queueName);

        this.userName = userName;
        this.password = password;

        queue.setMessageBodyStyle(WMQConstants.WMQ_MESSAGE_BODY_MQ);
        if (mbj != null) {
            if (Boolean.parseBoolean(mbj)) {
                queue.setMessageBodyStyle(WMQConstants.WMQ_MESSAGE_BODY_JMS);
            }
        }

        if (timeToLive != null) {
            this.timeToLive = Long.parseLong(timeToLive);
        }
        if (persistent != null) {
            this.deliveryMode = Boolean.parseBoolean(persistent) ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT;
        }

        if (sslCipherSuite != null) {
            mqConnFactory.setSSLCipherSuite(sslCipherSuite);
            if (sslPeerName != null)
            {
                mqConnFactory.setSSLPeerName(sslPeerName);
            }
        }
    }
    catch (JMSException | JMSRuntimeException jmse) {
        log.debug("JMS exception {}", jmse);
        throw new ConnectException(jmse);
    }

    try {
        Class<? extends MessageBuilder> c = Class.forName(builderClass).asSubclass(MessageBuilder.class);
        builder = c.newInstance();
    }
    catch (ClassNotFoundException | IllegalAccessException | InstantiationException | NullPointerException exc) {
        log.debug("Could not instantiate message builder {}", builderClass);
        throw new ConnectException("Could not instantiate message builder", exc);
    }
}
 
開發者ID:ibm-messaging,項目名稱:kafka-connect-mq-sink,代碼行數:69,代碼來源:JMSWriter.java


注:本文中的javax.jms.DeliveryMode.NON_PERSISTENT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。