Java Code Examples for javax.jms.MessageProducer#getPriority()

The following examples show how to use javax.jms.MessageProducer#getPriority() . 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: JmsPoolMessageProducer.java    From pooled-jms with Apache License 2.0 6 votes vote down vote up
public JmsPoolMessageProducer(JmsPoolSession session, MessageProducer messageProducer, Destination destination, AtomicInteger refCount) throws JMSException {
    this.session = session;
    this.messageProducer = messageProducer;
    this.destination = destination;
    this.refCount = refCount;
    this.anonymousProducer = destination == null;

    this.deliveryMode = messageProducer.getDeliveryMode();
    this.disableMessageID = messageProducer.getDisableMessageID();
    this.disableMessageTimestamp = messageProducer.getDisableMessageTimestamp();
    this.priority = messageProducer.getPriority();
    this.timeToLive = messageProducer.getTimeToLive();

    if (session.isJMSVersionSupported(2, 0)) {
        this.deliveryDelay = messageProducer.getDeliveryDelay();
    }
}
 
Example 2
Source File: MessageProducerTest.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetPriorityOnClosedProducer() throws Exception {
   Connection pconn = createConnection();

   try {
      Session ps = pconn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      MessageProducer p = ps.createProducer(ActiveMQServerTestCase.topic1);

      p.close();

      try {
         p.getPriority();
         ProxyAssertSupport.fail("should throw exception");
      } catch (javax.jms.IllegalStateException e) {
         // OK
      }
   } finally {
      pconn.close();
   }
}
 
Example 3
Source File: ClientJmsDelegate.java    From qpid-broker-j with Apache License 2.0 5 votes vote down vote up
public Message sendNextMessage(final CreateProducerCommand command)
{
    final String messageProviderName = command.getMessageProviderName();
    final MessageProvider messageProvider = getMessageProvider(messageProviderName);

    final Session session = _testSessions.get(command.getSessionName());
    final MessageProducer producer = _testProducers.get(command.getParticipantName());
    try
    {
        Message message = messageProvider.nextMessage(session, command);
        int deliveryMode = producer.getDeliveryMode();
        int priority = producer.getPriority();
        long ttl = producer.getTimeToLive();
        if (messageProvider.isPropertySet(MessageProvider.PRIORITY))
        {
            priority = message.getJMSPriority();
        }
        if (messageProvider.isPropertySet(MessageProvider.DELIVERY_MODE))
        {
            deliveryMode = message.getJMSDeliveryMode();
        }
        if (messageProvider.isPropertySet(MessageProvider.TTL))
        {
            ttl = message.getLongProperty(MessageProvider.TTL);
        }
        producer.send(message, deliveryMode, priority, ttl);
        return message;
    }
    catch (final JMSException jmse)
    {
        throw new DistributedTestException("Unable to create and send message with producer: " +
                        command.getParticipantName() + " on session: " + command.getSessionName(), jmse);
    }
}
 
Example 4
Source File: CachedMessageProducer.java    From spring-analysis-note with MIT License 4 votes vote down vote up
public CachedMessageProducer(MessageProducer target) throws JMSException {
	this.target = target;
	this.deliveryMode = target.getDeliveryMode();
	this.priority = target.getPriority();
	this.timeToLive = target.getTimeToLive();
}
 
Example 5
Source File: CachedMessageProducer.java    From java-technology-stack with MIT License 4 votes vote down vote up
public CachedMessageProducer(MessageProducer target) throws JMSException {
	this.target = target;
	this.deliveryMode = target.getDeliveryMode();
	this.priority = target.getPriority();
	this.timeToLive = target.getTimeToLive();
}
 
Example 6
Source File: CachedMessageProducer.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
public CachedMessageProducer(MessageProducer target) throws JMSException {
	this.target = target;
	this.deliveryMode = target.getDeliveryMode();
	this.priority = target.getPriority();
	this.timeToLive = target.getTimeToLive();
}