Tabnine Logo
TextMessage.getJMSExpiration
Code IndexAdd Tabnine to your IDE (free)

How to use
getJMSExpiration
method
in
javax.jms.TextMessage

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

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.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

@Test
public void testJMSExpirationOnSelector() throws Exception {
 Connection conn = null;
 try {
   conn = getConnectionFactory().createConnection();
   conn.start();
   Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
   MessageProducer prod = session.createProducer(queue1);
   TextMessage msg1 = session.createTextMessage("msg1");
   prod.send(msg1);
   prod.setTimeToLive(100000);
   TextMessage msg2 = session.createTextMessage("msg2");
   prod.send(msg2);
   long expire = msg2.getJMSExpiration();
   String selector = "JMSExpiration = " + expire;
   MessageConsumer cons = session.createConsumer(queue1, selector);
   conn.start();
   TextMessage rec = (TextMessage) cons.receive(10000);
   assertNotNull(rec);
   Assert.assertEquals("msg2", rec.getText());
   assertNull(cons.receiveNoWait());
 } finally {
   if (conn != null) {
    conn.close();
   }
 }
}
origin: apache/activemq-artemis

@Test(timeout = 30000)
public void testSelectorsWithJMSExpirationOnQueue() throws Exception {
 final Connection connection = createConnection();
 try {
   Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
   Destination destination = session.createQueue(getQueueName());
   MessageProducer producer = session.createProducer(destination);
   TextMessage message1 = session.createTextMessage();
   message1.setText("filtered");
   producer.send(message1, DeliveryMode.PERSISTENT, Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE);
   TextMessage message2 = session.createTextMessage();
   message2.setText("expected");
   producer.send(message2, DeliveryMode.PERSISTENT, Message.DEFAULT_PRIORITY, 60000);
   MessageConsumer consumer = session.createConsumer(destination, "JMSExpiration = " + message2.getJMSExpiration());
   connection.start();
   Message msg = consumer.receive(2000);
   assertNotNull(msg);
   assertTrue(msg instanceof TextMessage);
   assertEquals("Unexpected JMSExpiration value", message2.getJMSExpiration(), msg.getJMSExpiration());
   assertEquals("Unexpected message content", "expected", ((TextMessage) msg).getText());
 } finally {
   connection.close();
 }
}
javax.jmsTextMessagegetJMSExpiration

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,
  • getJMSPriority,
  • clearBody

Popular in Java

  • Parsing JSON documents to java classes using gson
  • putExtra (Intent)
  • runOnUiThread (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now