本文整理汇总了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);
}
}
示例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));
}
}
示例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));
}
}
示例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));
}
}
示例5: getDeliveryMode
private int getDeliveryMode() {
if (persistentDelivery) {
return DeliveryMode.PERSISTENT;
}
return DeliveryMode.NON_PERSISTENT;
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
}
示例12: setUp
@Override
protected void setUp() throws Exception {
topic = true;
durable = false;
deliveryMode = DeliveryMode.NON_PERSISTENT;
super.setUp();
}
示例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();
}
示例14: getJMSDeliveryMode
@Override
public int getJMSDeliveryMode() throws JMSException {
return persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT;
}
示例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);
}
}