Java Code Examples for javax.jms.JMSProducer#setPriority()
The following examples show how to use
javax.jms.JMSProducer#setPriority() .
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 |
private void doTestSendAppliesPriorityWithMessageBody(Class<?> bodyType) throws JMSException { JMSProducer producer = context.createProducer(); producer.setPriority(0); producer.send(JMS_DESTINATION, "text"); JmsOutboundMessageDispatch envelope = remotePeer.getLastReceivedMessage(); assertNotNull(envelope); JmsMessage message = envelope.getMessage(); assertEquals(0, message.getJMSPriority()); producer.setPriority(7); producer.send(JMS_DESTINATION, "text"); envelope = remotePeer.getLastReceivedMessage(); assertNotNull(envelope); message = envelope.getMessage(); assertEquals(7, message.getJMSPriority()); }
Example 2
Source File: JmsPoolJMSProducerTest.java From pooled-jms with Apache License 2.0 | 5 votes |
@Test public void testPriority() { JMSProducer producer = context.createProducer(); producer.setPriority(1); assertEquals(1, producer.getPriority()); producer.setPriority(4); assertEquals(4, producer.getPriority()); }
Example 3
Source File: JmsPoolJMSProducerTest.java From pooled-jms with Apache License 2.0 | 5 votes |
private void doTestSendAppliesPriorityWithMessageBody(Class<?> bodyType) throws JMSException { JMSProducer producer = context.createProducer(); final AtomicBoolean lowPriority = new AtomicBoolean(); final AtomicBoolean highPriority = new AtomicBoolean(); MockJMSConnection connection = (MockJMSConnection) context.getConnection(); connection.addConnectionListener(new MockJMSDefaultConnectionListener() { @Override public void onMessageSend(MockJMSSession session, Message message) throws JMSException { if (!lowPriority.get()) { assertEquals(0, message.getJMSPriority()); lowPriority.set(true); } else { assertEquals(7, message.getJMSPriority()); highPriority.set(true); } } }); producer.setPriority(0); producer.send(JMS_DESTINATION, "text"); producer.setPriority(7); producer.send(JMS_DESTINATION, "text"); assertTrue(lowPriority.get()); assertTrue(highPriority.get()); }
Example 4
Source File: JmsProducerTest.java From qpid-jms with Apache License 2.0 | 5 votes |
@Test public void testPriority() { JMSProducer producer = context.createProducer(); producer.setPriority(1); assertEquals(1, producer.getPriority()); producer.setPriority(4); assertEquals(4, producer.getPriority()); }
Example 5
Source File: JmsProducer.java From pentaho-kettle with Apache License 2.0 | 4 votes |
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 ); } }