当前位置: 首页>>代码示例>>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;未经允许,请勿转载。