@Override public void setDisableMessageID(boolean value) throws JMSException { delegate.setDisableMessageID(value); }
@Override public void setDisableMessageID(boolean disableMessageID) throws JMSException { if (this.originalDisableMessageID == null) { this.originalDisableMessageID = this.target.getDisableMessageID(); } this.target.setDisableMessageID(disableMessageID); }
@Override public JMSProducer setDisableMessageID(boolean value) { try { producer.setDisableMessageID(value); } catch (JMSException e) { throw JmsExceptionUtils.convertToRuntimeException(e); } return this; }
@Override public void close() throws JMSException { // It's a cached MessageProducer... reset properties only. if (this.originalDisableMessageID != null) { this.target.setDisableMessageID(this.originalDisableMessageID); this.originalDisableMessageID = null; } if (this.originalDisableMessageTimestamp != null) { this.target.setDisableMessageTimestamp(this.originalDisableMessageTimestamp); this.originalDisableMessageTimestamp = null; } if (this.originalDeliveryDelay != null) { this.target.setDeliveryDelay(this.originalDeliveryDelay); this.originalDeliveryDelay = null; } }
/** * Create a JMS MessageProducer for the given Session and Destination, * configuring it to disable message ids and/or timestamps (if necessary). * <p>Delegates to {@link #doCreateProducer} for creation of the raw * JMS MessageProducer. * @param session the JMS Session to create a MessageProducer for * @param destination the JMS Destination to create a MessageProducer for * @return the new JMS MessageProducer * @throws JMSException if thrown by JMS API methods * @see #setMessageIdEnabled * @see #setMessageTimestampEnabled */ protected MessageProducer createProducer(Session session, @Nullable Destination destination) throws JMSException { MessageProducer producer = doCreateProducer(session, destination); if (!isMessageIdEnabled()) { producer.setDisableMessageID(true); } if (!isMessageTimestampEnabled()) { producer.setDisableMessageTimestamp(true); } return producer; }
@Test public void testProducerCallbackWithIdAndTimestampDisabled() throws Exception { JmsTemplate template = createTemplate(); template.setConnectionFactory(this.connectionFactory); template.setMessageIdEnabled(false); template.setMessageTimestampEnabled(false); MessageProducer messageProducer = mock(MessageProducer.class); given(this.session.createProducer(null)).willReturn(messageProducer); given(messageProducer.getPriority()).willReturn(4); template.execute((ProducerCallback<Void>) (session1, producer) -> { session1.getTransacted(); producer.getPriority(); return null; }); verify(messageProducer).setDisableMessageID(true); verify(messageProducer).setDisableMessageTimestamp(true); verify(messageProducer).close(); verify(this.session).close(); verify(this.connection).close(); }
verify(messageProducer).setDisableMessageID(true); verify(messageProducer).setDisableMessageTimestamp(true);
@Override public JMSProducer setDisableMessageID(boolean value) { try { producer.setDisableMessageID(value); } catch (JMSException e) { throw JmsExceptionUtils.convertToRuntimeException(e); } return this; }
@Override public void setDisableMessageID(boolean disableMessageID) throws JMSException { if (this.originalDisableMessageID == null) { this.originalDisableMessageID = this.target.getDisableMessageID(); } this.target.setDisableMessageID(disableMessageID); }
@Override public JMSProducer setDisableMessageID(boolean value) { try { producer.setDisableMessageID(value); } catch (JMSException e) { throw JmsExceptionUtils.convertToRuntimeException(e); } return this; }
@Override public JMSProducer setDisableMessageID(final boolean value) { try { producer.setDisableMessageID(value); } catch (final JMSException e) { throw toRuntimeException(e); } return this; }
public void setDisableMessageID(boolean disableMessageID) throws JMSException { if (this.originalDisableMessageID == null) { this.originalDisableMessageID = Boolean.valueOf(this.target.getDisableMessageID()); } this.target.setDisableMessageID(disableMessageID); }
@Override public JMSProducer setDisableMessageID(boolean value) { try { producer.setDisableMessageID(value); } catch (JMSException e) { throw JmsExceptionUtils.convertToRuntimeException(e); } return this; }
public void close() throws JMSException { // It's a cached MessageProducer... reset properties only. if (this.originalDisableMessageID != null) { this.target.setDisableMessageID(this.originalDisableMessageID.booleanValue()); this.originalDisableMessageID = null; } if (this.originalDisableMessageTimestamp != null) { this.target.setDisableMessageTimestamp(this.originalDisableMessageTimestamp.booleanValue()); this.originalDisableMessageTimestamp = null; } }
/** Delegates the call to the wrapped producer. */ public void setDisableMessageID(boolean value) throws JMSException { checkValidity(); producer.setDisableMessageID(value); }
/** Delegates the call to the wrapped producer. */ public void setDisableMessageID(boolean value) throws JMSException { checkValidity(); producer.setDisableMessageID(value); }
@Override public JMSProducer setDisableMessageID(boolean value) { try { producer.setDisableMessageID(value); } catch (JMSException e) { throw JmsExceptionUtils.convertToRuntimeException(e); } return this; }
/** * Set disable message id * * @param value The value * @throws JMSException Thrown if an error occurs */ @Override public void setDisableMessageID(final boolean value) throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("setDisableMessageID(" + value + ")"); } producer.setDisableMessageID(value); }
private void sendMessage(Queue queue, Session session) throws Exception { MessageProducer mp = session.createProducer(queue); try { mp.setDisableMessageID(true); mp.setDeliveryMode(DeliveryMode.NON_PERSISTENT); mp.setPriority(Message.DEFAULT_PRIORITY); mp.setTimeToLive(Message.DEFAULT_TIME_TO_LIVE); mp.send(session.createTextMessage("This is message for " + queue.getQueueName())); } finally { mp.close(); } } }
public static MessageProducer createMessageProducer( Session session, Destination destination, MessageProducerOption producerOption) throws JMSException { MessageProducer producer = session.createProducer(destination); producer.setDeliveryDelay(producerOption.getDeliveryDelay()); producer.setDeliveryMode(producerOption.getDeliveryMode()); producer.setDisableMessageTimestamp(producerOption.isDisableMessageTimestamp()); producer.setDisableMessageID(producerOption.isDisableMessageId()); producer.setPriority(producerOption.getPriority()); producer.setTimeToLive(producerOption.getTimeToLive()); return producer; }