Java Code Examples for javax.jms.JMSProducer#setDisableMessageID()

The following examples show how to use javax.jms.JMSProducer#setDisableMessageID() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JmsProducerTest.java    From qpid-jms with Apache License 2.0 6 votes vote down vote up
private void doTestSendAppliesDisableMessageIDWithMessageBody(Class<?> bodyType) throws JMSException {
    JMSProducer producer = context.createProducer();

    producer.setDisableMessageID(true);
    producer.send(JMS_DESTINATION, "text");
    JmsOutboundMessageDispatch envelope = remotePeer.getLastReceivedMessage();
    assertNotNull(envelope);
    JmsMessage message = envelope.getMessage();
    assertNull(message.getJMSMessageID());

    producer.setDisableMessageID(false);
    producer.send(JMS_DESTINATION, "text");
    envelope = remotePeer.getLastReceivedMessage();
    assertNotNull(envelope);
    message = envelope.getMessage();
    assertNotNull(message.getJMSMessageID());
}
 
Example 2
Source File: JmsProducerTest.java    From qpid-jms with Apache License 2.0 5 votes vote down vote up
@Test
public void testDisableMessageID() {
    JMSProducer producer = context.createProducer();

    producer.setDisableMessageID(false);
    assertEquals(false, producer.getDisableMessageID());
    producer.setDisableMessageID(true);
    assertEquals(true, producer.getDisableMessageID());
}
 
Example 3
Source File: JmsProducer.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void setOptions( JMSProducer producer ) {
  String optionValue = meta.getDisableMessageId();
  getLogChannel().logDebug( "Disable Message ID is set to " + optionValue );
  if ( !StringUtil.isEmpty( optionValue ) ) {
    producer.setDisableMessageID( BooleanUtils.toBoolean( optionValue ) );
  }

  optionValue = meta.getDisableMessageTimestamp();
  getLogChannel().logDebug( "Disable Message Timestamp is set to " + optionValue );
  if ( !StringUtil.isEmpty( optionValue ) ) {
    producer.setDisableMessageTimestamp( BooleanUtils.toBoolean( optionValue ) );
  }

  optionValue = meta.getDeliveryMode();
  getLogChannel().logDebug( "Delivery Mode is set to " + optionValue );
  if ( !StringUtil.isEmpty( optionValue ) ) {
    producer.setDeliveryMode( Integer.parseInt( optionValue ) );
  }

  optionValue = meta.getPriority();
  getLogChannel().logDebug( "Priority is set to " + optionValue );
  if ( !StringUtil.isEmpty( optionValue ) ) {
    producer.setPriority( Integer.parseInt( optionValue ) );
  }

  optionValue = meta.getTimeToLive();
  getLogChannel().logDebug( "Time to Live is set to " + optionValue );
  if ( !StringUtil.isEmpty( optionValue ) ) {
    producer.setTimeToLive( Long.parseLong( optionValue ) );
  }

  optionValue = meta.getDeliveryDelay();
  getLogChannel().logDebug( "Delivery Delay is set to " + optionValue );
  if ( !StringUtil.isEmpty( optionValue ) ) {
    producer.setDeliveryDelay( Long.parseLong( optionValue ) );
  }

  optionValue = meta.getJmsCorrelationId();
  getLogChannel().logDebug( "JMS Correlation ID is set to " + optionValue );
  if ( !StringUtil.isEmpty( optionValue ) ) {
    producer.setJMSCorrelationID( optionValue );
  }

  optionValue = meta.getJmsType();
  getLogChannel().logDebug( "JMS Type is set to " + optionValue );
  if ( !StringUtil.isEmpty( optionValue ) ) {
    producer.setJMSType( optionValue );
  }
}