Codota Logo
TextMessage.getJMSPriority
Code IndexAdd Codota to your IDE (free)

How to use
getJMSPriority
method
in
javax.jms.TextMessage

Best Java code snippets using javax.jms.TextMessage.getJMSPriority (Showing top 19 results out of 315)

  • Common ways to obtain TextMessage
private void myMethod () {
TextMessage t =
  • Codota IconSession session;String text;session.createTextMessage(text)
  • Codota IconSession session;session.createTextMessage()
  • Codota IconQueueSession senderSession;senderSession.createTextMessage()
  • Smart code suggestions by Codota
}
origin: com.betfair.cougar/jms-transport

  @Override
  // Get the jms session belonging to the thread publishing this event
  public void run() {
    MessageProducer messageProducer = null;
    try {
      Session session = sessionManager.get();
      Destination destination = createDestination(session, destinationName);
      messageProducer = session.createProducer(destination);
      TextMessage textMessage = getEventMarshaller().marshallEvent(descriptor, event, session);
      messageProducer.send(textMessage, textMessage.getJMSDeliveryMode(), textMessage.getJMSPriority(), textMessage.getJMSExpiration());
      success = true;
    } catch (CougarFrameworkException cfe) { // Catch possible exception thrown from session creation
      success = false;
      error = cfe;
    } catch (JMSException ex) { // Catch any other exception thrown during message publication
      success = false;
      error = ex;
    } finally {
      if (messageProducer != null) {
        try {
          messageProducer.close();
        } catch (JMSException e) {
          LOGGER.warn("Failed to close message producer", e);
        }
      }
      unlock();
    }
  }
}
origin: org.ikasan/ikasan-framework

@Override
protected Event handleTextMessage(TextMessage message) throws JMSException
{
  Payload payload = payloadFactory.newPayload(message.getJMSMessageID(), message.getText().getBytes());
  //
  Event event = new Event(moduleName, name, message.getJMSMessageID(), payload);
  // Reuse the message's priority if we are configured to respect it
  if (respectPriority)
  {
    event.setPriority(message.getJMSPriority());
  }
  else
  {
    event.setPriority(DEFAULT_MESSAGE_PRIORITY);
  }
  return event;
}
origin: org.ikasan/ikasan-framework

@Override
protected Event handleTextMessage(TextMessage message) throws JMSException
{
  Payload payload = payloadFactory.newPayload(message.getJMSMessageID(), message.getText().getBytes());
  //
  Event event = new Event(moduleName, name, message.getJMSMessageID(), payload);
  // Reuse the message's priority if we are configured to respect it
  if (respectPriority)
  {
    event.setPriority(message.getJMSPriority());
  }
  else
  {
    event.setPriority(DEFAULT_MESSAGE_PRIORITY);
  }
  return event;
}
origin: org.apache.beam/beam-sdks-java-io-jms

 @Override
 public JmsRecord mapMessage(Message message) throws Exception {
  TextMessage textMessage = (TextMessage) message;
  Map<String, Object> properties = new HashMap<>();
  @SuppressWarnings("rawtypes")
  Enumeration propertyNames = textMessage.getPropertyNames();
  while (propertyNames.hasMoreElements()) {
   String propertyName = (String) propertyNames.nextElement();
   properties.put(propertyName, textMessage.getObjectProperty(propertyName));
  }
  JmsRecord jmsRecord =
    new JmsRecord(
      textMessage.getJMSMessageID(),
      textMessage.getJMSTimestamp(),
      textMessage.getJMSCorrelationID(),
      textMessage.getJMSReplyTo(),
      textMessage.getJMSDestination(),
      textMessage.getJMSDeliveryMode(),
      textMessage.getJMSRedelivered(),
      textMessage.getJMSType(),
      textMessage.getJMSExpiration(),
      textMessage.getJMSPriority(),
      properties,
      textMessage.getText());
  return jmsRecord;
 }
})
origin: apache/activemq-artemis

ProxyAssertSupport.assertNotNull(t);
ProxyAssertSupport.assertEquals("a", t.getText());
ProxyAssertSupport.assertEquals(7, t.getJMSPriority());
origin: apache/activemq-artemis

@Test
public void testSendMessage() throws Exception {
 MessageConsumer consumer = session.createConsumer(queue);
 conn.connect(defUser, defPass);
 send(conn, getQueuePrefix() + getQueueName(), null, "Hello World");
 TextMessage message = (TextMessage) consumer.receive(1000);
 Assert.assertNotNull(message);
 Assert.assertEquals("Hello World", message.getText());
 // Assert default priority 4 is used when priority header is not set
 Assert.assertEquals("getJMSPriority", 4, message.getJMSPriority());
 // Make sure that the timestamp is valid - should
 // be very close to the current time.
 long tnow = System.currentTimeMillis();
 long tmsg = message.getJMSTimestamp();
 Assert.assertTrue(Math.abs(tnow - tmsg) < 1000);
}
origin: apache/activemq-artemis

@Test
public void testSendMessage() throws Exception {
 MessageConsumer consumer = session.createConsumer(queue);
 conn.connect(defUser, defPass);
 send(conn, getQueuePrefix() + getQueueName(), null, "Hello World");
 TextMessage message = (TextMessage) consumer.receive(1000);
 Assert.assertNotNull(message);
 Assert.assertEquals("Hello World", message.getText());
 // Assert default priority 4 is used when priority header is not set
 Assert.assertEquals("getJMSPriority", 4, message.getJMSPriority());
 // Make sure that the timestamp is valid - should
 // be very close to the current time.
 long tnow = System.currentTimeMillis();
 long tmsg = message.getJMSTimestamp();
 Assert.assertTrue(Math.abs(tnow - tmsg) < 1000);
}
origin: apache/activemq-artemis

@Test
public void testSendMessage() throws Exception {
 MessageConsumer consumer = session.createConsumer(queue);
 conn.connect(defUser, defPass);
 send(conn, getQueuePrefix() + getQueueName(), null, "Hello World");
 TextMessage message = (TextMessage) consumer.receive(1000);
 Assert.assertNotNull(message);
 Assert.assertEquals("Hello World", message.getText());
 // Assert default priority 4 is used when priority header is not set
 Assert.assertEquals("getJMSPriority", 4, message.getJMSPriority());
 // Make sure that the timestamp is valid - should
 // be very close to the current time.
 long tnow = System.currentTimeMillis();
 long tmsg = message.getJMSTimestamp();
 Assert.assertTrue(Math.abs(tnow - tmsg) < 1000);
}
origin: apache/activemq-artemis

public void sendMessageToNonExistentTopic(String topicPrefix, String topic, RoutingType routingType) throws Exception {
 conn.connect(defUser, defPass);
 // first send a message to ensure that sending to a non-existent topic won't throw an error
 send(conn, topicPrefix + topic, null, "Hello World", true, routingType);
 // create a subscription on the topic and send/receive another message
 MessageConsumer consumer = session.createConsumer(ActiveMQJMSClient.createTopic(topic));
 send(conn, topicPrefix + topic, null, "Hello World", true, routingType);
 TextMessage message = (TextMessage) consumer.receive(1000);
 Assert.assertNotNull(message);
 Assert.assertEquals("Hello World", message.getText());
 // Assert default priority 4 is used when priority header is not set
 Assert.assertEquals("getJMSPriority", 4, message.getJMSPriority());
 // Make sure that the timestamp is valid - should
 // be very close to the current time.
 long tnow = System.currentTimeMillis();
 long tmsg = message.getJMSTimestamp();
 Assert.assertTrue(Math.abs(tnow - tmsg) < 1500);
 assertNotNull(server.getAddressInfo(new SimpleString(topic)));
 // closing the consumer here should trigger auto-deletion of the subscription queue and address
 consumer.close();
 Thread.sleep(200);
 assertNull(server.getAddressInfo(new SimpleString(topic)));
}
origin: apache/activemq-artemis

public void sendMessageToNonExistentQueue(String queuePrefix, String queue, RoutingType routingType) throws Exception {
 conn.connect(defUser, defPass);
 send(conn, queuePrefix + queue, null, "Hello World", true, routingType);
 MessageConsumer consumer = session.createConsumer(ActiveMQJMSClient.createQueue(queue));
 TextMessage message = (TextMessage) consumer.receive(1000);
 Assert.assertNotNull(message);
 Assert.assertEquals("Hello World", message.getText());
 // Assert default priority 4 is used when priority header is not set
 Assert.assertEquals("getJMSPriority", 4, message.getJMSPriority());
 // Make sure that the timestamp is valid - should
 // be very close to the current time.
 long tnow = System.currentTimeMillis();
 long tmsg = message.getJMSTimestamp();
 Assert.assertTrue(Math.abs(tnow - tmsg) < 1500);
 // closing the consumer here should trigger auto-deletion
 assertNotNull(server.getPostOffice().getBinding(new SimpleString(queue)));
 consumer.close();
 assertNull(server.getPostOffice().getBinding(new SimpleString(queue)));
}
origin: apache/activemq-artemis

  @Test
  public void testJMSXUserID() throws Exception {
   server.getConfiguration().setPopulateValidatedUser(true);

   MessageConsumer consumer = session.createConsumer(queue);

   StompClientConnection conn = StompClientConnectionFactory.createClientConnection(uri);
   conn.connect(defUser, defPass);

   ClientStompFrame frame = conn.createFrame("SEND");
   frame.addHeader("destination", getQueuePrefix() + getQueueName());
   frame.setBody("Hello World");
   conn.sendFrame(frame);

   conn.disconnect();

   TextMessage message = (TextMessage) consumer.receive(1000);
   Assert.assertNotNull(message);
   Assert.assertEquals("Hello World", message.getText());
   // Assert default priority 4 is used when priority header is not set
   Assert.assertEquals("getJMSPriority", 4, message.getJMSPriority());
   Assert.assertEquals("JMSXUserID", "brianm", message.getStringProperty("JMSXUserID"));

   // Make sure that the timestamp is valid - should
   // be very close to the current time.
   long tnow = System.currentTimeMillis();
   long tmsg = message.getJMSTimestamp();
   Assert.assertTrue(Math.abs(tnow - tmsg) < 1000);
  }
}
origin: apache/activemq-artemis

Assert.assertEquals("JMSCorrelationID", "c123", message.getJMSCorrelationID());
Assert.assertEquals("getJMSType", "t345", message.getJMSType());
Assert.assertEquals("getJMSPriority", 3, message.getJMSPriority());
Assert.assertEquals(javax.jms.DeliveryMode.PERSISTENT, message.getJMSDeliveryMode());
Assert.assertEquals("foo", "abc", message.getStringProperty("foo"));
origin: apache/activemq-artemis

Assert.assertEquals("JMSCorrelationID", "c123", message.getJMSCorrelationID());
Assert.assertEquals("getJMSType", "t345", message.getJMSType());
Assert.assertEquals("getJMSPriority", 3, message.getJMSPriority());
Assert.assertEquals(javax.jms.DeliveryMode.PERSISTENT, message.getJMSDeliveryMode());
Assert.assertEquals("foo", "abc", message.getStringProperty("foo"));
origin: apache/activemq-artemis

Assert.assertEquals("JMSCorrelationID", "c123", message.getJMSCorrelationID());
Assert.assertEquals("getJMSType", "t345", message.getJMSType());
Assert.assertEquals("getJMSPriority", 3, message.getJMSPriority());
Assert.assertEquals(javax.jms.DeliveryMode.PERSISTENT, message.getJMSDeliveryMode());
Assert.assertEquals("foo", "abc", message.getStringProperty("foo"));
origin: apache/activemq-artemis

@Test
public void testSendMessageWithDeliveryTime() throws Exception {
 MessageConsumer consumer = session.createConsumer(queue);
 conn.connect(defUser, defPass);
 ClientStompFrame frame = conn.createFrame(Stomp.Commands.SEND)
                .addHeader(Stomp.Headers.Send.DESTINATION, getQueuePrefix() + getQueueName())
                .addHeader("foo", "abc")
                .addHeader("bar", "123")
                .addHeader("correlation-id", "c123")
                .addHeader("persistent", "true")
                .addHeader("type", "t345")
                .addHeader("JMSXGroupID", "abc")
                .addHeader("priority", "3")
                .addHeader("AMQ_SCHEDULED_TIME", Long.toString(System.currentTimeMillis() + 2000))
                .setBody("Hello World");
 conn.sendFrame(frame);
 assertNull("Should not receive message yet", consumer.receive(1000));
 TextMessage message = (TextMessage) consumer.receive(4000);
 Assert.assertNotNull(message);
 Assert.assertEquals("Hello World", message.getText());
 Assert.assertEquals("JMSCorrelationID", "c123", message.getJMSCorrelationID());
 Assert.assertEquals("getJMSType", "t345", message.getJMSType());
 Assert.assertEquals("getJMSPriority", 3, message.getJMSPriority());
 Assert.assertEquals(javax.jms.DeliveryMode.PERSISTENT, message.getJMSDeliveryMode());
 Assert.assertEquals("foo", "abc", message.getStringProperty("foo"));
 Assert.assertEquals("JMSXGroupID", "abc", message.getStringProperty("JMSXGroupID"));
}
origin: apache/activemq-artemis

@Test
public void testSendMessageWithDelay() throws Exception {
 MessageConsumer consumer = session.createConsumer(queue);
 conn.connect(defUser, defPass);
 ClientStompFrame frame = conn.createFrame(Stomp.Commands.SEND)
                .addHeader(Stomp.Headers.Send.DESTINATION, getQueuePrefix() + getQueueName())
                .addHeader("foo", "abc")
                .addHeader("bar", "123")
                .addHeader("correlation-id", "c123")
                .addHeader("persistent", "true")
                .addHeader("type", "t345")
                .addHeader("JMSXGroupID", "abc")
                .addHeader("priority", "3")
                .addHeader("AMQ_SCHEDULED_DELAY", "2000")
                .setBody("Hello World");
 conn.sendFrame(frame);
 assertNull("Should not receive message yet", consumer.receive(1000));
 TextMessage message = (TextMessage) consumer.receive(4000);
 Assert.assertNotNull(message);
 Assert.assertEquals("Hello World", message.getText());
 Assert.assertEquals("JMSCorrelationID", "c123", message.getJMSCorrelationID());
 Assert.assertEquals("getJMSType", "t345", message.getJMSType());
 Assert.assertEquals("getJMSPriority", 3, message.getJMSPriority());
 Assert.assertEquals(javax.jms.DeliveryMode.PERSISTENT, message.getJMSDeliveryMode());
 Assert.assertEquals("foo", "abc", message.getStringProperty("foo"));
 Assert.assertEquals("JMSXGroupID", "abc", message.getStringProperty("JMSXGroupID"));
}
origin: apache/activemq-artemis

@Test
public void testSendMessageWithStandardHeaders() throws Exception {
 MessageConsumer consumer = session.createConsumer(queue);
 conn.connect(defUser, defPass);
 ClientStompFrame frame = conn.createFrame(Stomp.Commands.SEND)
                .addHeader(Stomp.Headers.Subscribe.DESTINATION, getQueuePrefix() + getQueueName())
                .addHeader("correlation-id", "c123")
                .addHeader("persistent", "true")
                .addHeader("priority", "3")
                .addHeader(Stomp.Headers.Message.TYPE, "t345")
                .addHeader("JMSXGroupID", "abc")
                .addHeader("foo", "abc")
                .addHeader("bar", "123")
                .setBody("Hello World");
 conn.sendFrame(frame);
 TextMessage message = (TextMessage) consumer.receive(1000);
 Assert.assertNotNull(message);
 Assert.assertEquals("Hello World", message.getText());
 Assert.assertEquals("JMSCorrelationID", "c123", message.getJMSCorrelationID());
 Assert.assertEquals("getJMSType", "t345", message.getJMSType());
 Assert.assertEquals("getJMSPriority", 3, message.getJMSPriority());
 Assert.assertEquals(javax.jms.DeliveryMode.PERSISTENT, message.getJMSDeliveryMode());
 Assert.assertEquals("foo", "abc", message.getStringProperty("foo"));
 Assert.assertEquals("bar", "123", message.getStringProperty("bar"));
 Assert.assertEquals("JMSXGroupID", "abc", message.getStringProperty("JMSXGroupID"));
 conn.disconnect();
}
origin: apache/activemq-artemis

@Test
public void testSendMessageWithStandardHeaders() throws Exception {
 MessageConsumer consumer = session.createConsumer(queue);
 conn.connect(defUser, defPass);
 ClientStompFrame frame = conn.createFrame(Stomp.Commands.SEND)
                .addHeader(Stomp.Headers.Send.DESTINATION, getQueuePrefix() + getQueueName())
                .addHeader("foo", "abc")
                .addHeader("bar", "123")
                .addHeader("correlation-id", "c123")
                .addHeader("persistent", "true")
                .addHeader("type", "t345")
                .addHeader("JMSXGroupID", "abc")
                .addHeader("priority", "3")
                .setBody("Hello World");
 conn.sendFrame(frame);
 TextMessage message = (TextMessage) consumer.receive(1000);
 Assert.assertNotNull(message);
 Assert.assertEquals("Hello World", message.getText());
 Assert.assertEquals("JMSCorrelationID", "c123", message.getJMSCorrelationID());
 Assert.assertEquals("getJMSType", "t345", message.getJMSType());
 Assert.assertEquals("getJMSPriority", 3, message.getJMSPriority());
 Assert.assertEquals(javax.jms.DeliveryMode.PERSISTENT, message.getJMSDeliveryMode());
 Assert.assertEquals("foo", "abc", message.getStringProperty("foo"));
 Assert.assertEquals("bar", "123", message.getStringProperty("bar"));
 Assert.assertEquals("JMSXGroupID", "abc", message.getStringProperty("JMSXGroupID"));
 // FIXME do we support it?
 // Assert.assertEquals("GroupID", "abc", amqMessage.getGroupID());
}
origin: apache/activemq-artemis

@Test
public void testSendMessageWithStandardHeaders() throws Exception {
 MessageConsumer consumer = session.createConsumer(queue);
 conn.connect(defUser, defPass);
 ClientStompFrame frame = conn.createFrame(Stomp.Commands.SEND)
                .addHeader(Stomp.Headers.Send.DESTINATION, getQueuePrefix() + getQueueName())
                .addHeader(Stomp.Headers.Message.CORRELATION_ID, "c123")
                .addHeader(Stomp.Headers.Message.PERSISTENT, "true")
                .addHeader(Stomp.Headers.Message.PRIORITY, "3")
                .addHeader(Stomp.Headers.Message.TYPE, "t345")
                .addHeader("JMSXGroupID", "abc")
                .addHeader("foo", "abc")
                .addHeader("bar", "123")
                .setBody("Hello World");
 frame = conn.sendFrame(frame);
 TextMessage message = (TextMessage) consumer.receive(1000);
 Assert.assertNotNull(message);
 Assert.assertEquals("Hello World", message.getText());
 Assert.assertEquals("JMSCorrelationID", "c123", message.getJMSCorrelationID());
 Assert.assertEquals("getJMSType", "t345", message.getJMSType());
 Assert.assertEquals("getJMSPriority", 3, message.getJMSPriority());
 Assert.assertEquals(javax.jms.DeliveryMode.PERSISTENT, message.getJMSDeliveryMode());
 Assert.assertEquals("foo", "abc", message.getStringProperty("foo"));
 Assert.assertEquals("bar", "123", message.getStringProperty("bar"));
 Assert.assertEquals("JMSXGroupID", "abc", message.getStringProperty("JMSXGroupID"));
 conn.disconnect();
}
javax.jmsTextMessagegetJMSPriority

Popular methods of TextMessage

  • getText
    Gets the string containing this message's data. The default value is null.
  • setText
    Sets the string containing this message's data.
  • setStringProperty
  • setJMSCorrelationID
  • setIntProperty
  • setLongProperty
  • getStringProperty
  • setBooleanProperty
  • setJMSReplyTo
  • getJMSCorrelationID
  • getJMSMessageID
  • getJMSReplyTo
  • getJMSMessageID,
  • getJMSReplyTo,
  • setDoubleProperty,
  • acknowledge,
  • setJMSType,
  • getJMSDeliveryMode,
  • setObjectProperty,
  • getIntProperty,
  • clearBody

Popular in Java

  • Start an intent from android
  • findViewById (Activity)
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • addToBackStack (FragmentTransaction)
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • TreeSet (java.util)
    A NavigableSet implementation based on a TreeMap. The elements are ordered using their Comparable, o
  • Vector (java.util)
    The Vector class implements a growable array of objects. Like an array, it contains components that
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Runner (org.openjdk.jmh.runner)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now