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

How to use
acknowledge
method
in
javax.jms.TextMessage

Best Java code snippets using javax.jms.TextMessage.acknowledge (Showing top 20 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: spring-projects/spring-framework

verify(textMessage).acknowledge();
origin: io.eventuate.tram.core/eventuate-tram-consumer-activemq

private void acknowledge(TextMessage textMessage) {
 try {
  textMessage.acknowledge();
 } catch (JMSException e) {
  logger.error(e.getMessage(), e);
 }
}
origin: io.skullabs.uworkers/uworkers

@Override
public <V> V receive(Class<V> target) throws JMSException, IOException {
  val received = receiveTextMessage();
  received.acknowledge();
  val jsonString = received.getText();
  val unserialize = unserialize(jsonString, target);
  return unserialize;
}
origin: stackoverflow.com

 Queue tempQueue = (Queue) ctx.lookup("tempQueue");
QueueSession queueLocalSession = 
 queueConn.createQueueSession(false,
   Session.CLIENT_ACKNOWLEDGE);  
QueueReceiver queueReceiver = queueLocalSession.createReceiver(tempQueue);
TextMessage localMessage = (TextMessage) queueReceiver.receive();

//send to remote queue
Queue remoteQueue = (Queue) ctx.lookup("remoteQueue");
QueueSender queueSender = queueRemoteSession.createSender(remoteQueue);
Message newMessage = queueRemoteSession.createTextMessage(
 localMessage.getText());
queueSender.send( newMessage);

//now acknowledge the message since we safely sent to remoteQueue
localMessage.acknowledge();
origin: apache/activemq-artemis

private int flushMessages(MessageConsumer consumer) throws JMSException {
 int received = 0;
 while (true) {
   TextMessage msg = (TextMessage) consumer.receiveNoWait();
   if (msg == null) {
    break;
   }
   msg.acknowledge();
   received++;
 }
 return received;
}
origin: apache/activemq-artemis

  @Override
  public void onMessage(Message m) {
   try {
     TextMessage tm = (TextMessage) m;
     assertEquals("" + counter.get(), tm.getText());
     counter.incrementAndGet();
     if (counter.get() == 2) {
      sendDone.await();
      connection.close();
      got2Done.countDown();
     }
     System.out.println("acking tm: " + tm.getText());
     tm.acknowledge();
   } catch (Throwable e) {
     System.out.println("ack failed!!");
     e.printStackTrace();
   }
  }
});
origin: apache/activemq-artemis

@Test
public void testClientACK() throws Exception {
 Queue queueSource = createQueue("Source");
 Queue queueTarget = createQueue("Dest");
 Connection connection = cf.createConnection();
 Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
 final MessageProducer producer = session.createProducer(queueSource);
 final TextMessage message = session.createTextMessage("message text");
 producer.send(message);
 connection.start();
 final MessageConsumer consumer = session.createConsumer(queueTarget);
 TextMessage receivedMessage = (TextMessage) consumer.receive(1000);
 Assert.assertNotNull(receivedMessage);
 receivedMessage.acknowledge();
 connection.close();
}
origin: apache/activemq-artemis

@Test
public void testSendEmpty() throws Exception {
 try (Connection connection = factory.createConnection()) {
   Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
   Queue queue = session.createQueue(queueName);
   System.out.println("Queue:" + queue);
   MessageProducer producer = session.createProducer(queue);
   MessageConsumer consumer = session.createConsumer(queue);
   producer.send(session.createTextMessage());
   Assert.assertNull(consumer.receive(100));
   connection.start();
   TextMessage message = (TextMessage) consumer.receive(5000);
   Assert.assertNotNull(message);
   message.acknowledge();
 }
}
origin: apache/activemq-artemis

@Test
public void testClientACK() throws Exception {
 try {
   Connection connection = factory.createConnection();
   Collection<Session> sessions = new LinkedList<>();
   Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
   Queue queue = session.createQueue(queueName);
   System.out.println("Queue:" + queue);
   MessageProducer producer = session.createProducer(queue);
   MessageConsumer consumer = session.createConsumer(queue);
   producer.send(session.createTextMessage("test"));
   Assert.assertNull(consumer.receive(100));
   connection.start();
   TextMessage message = (TextMessage) consumer.receive(5000);
   Assert.assertNotNull(message);
   message.acknowledge();
   connection.close();
   System.err.println("Done!!!");
 } catch (Throwable e) {
   e.printStackTrace();
 }
}
origin: apache/activemq-artemis

  @Test
  public void testClientAcknowledge() throws Exception {
   conn = createConnection();

   Session session = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
   MessageProducer p = session.createProducer(queue1);
   p.send(session.createTextMessage("CLACK"));

   MessageConsumer cons = session.createConsumer(queue1);

   conn.start();

   TextMessage m = (TextMessage) cons.receive(1000);

   ProxyAssertSupport.assertEquals("CLACK", m.getText());

   // make sure the message is still in "delivering" state
   assertRemainingMessages(1);

   m.acknowledge();

   assertRemainingMessages(0);
  }
}
origin: apache/activemq-artemis

@Test
public void testTransactionalSimple() throws Exception {
 try (Connection connection = factory.createConnection()) {
   Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
   Queue queue = session.createQueue(queueName);
   System.out.println("Queue:" + queue);
   MessageProducer producer = session.createProducer(queue);
   MessageConsumer consumer = session.createConsumer(queue);
   producer.send(session.createTextMessage("test"));
   session.commit();
   Assert.assertNull(consumer.receive(100));
   connection.start();
   TextMessage message = (TextMessage) consumer.receive(5000);
   Assert.assertEquals("test", message.getText());
   Assert.assertNotNull(message);
   message.acknowledge();
 }
}
origin: apache/activemq-artemis

  r1.acknowledge();
  r2.acknowledge();
  r3.acknowledge();
} finally {
  if (conn != null) {
origin: apache/activemq-artemis

  tm3.acknowledge();
} finally {
  if (conn != null) {
origin: apache/activemq-artemis

m.acknowledge();
origin: apache/activemq-artemis

@Test
public void testSimpleSendReceive() throws Exception {
 factory.setAlwaysSyncSend(true);
 flowControlConnection = (ActiveMQConnection) factory.createConnection();
 flowControlConnection.start();
 Session session = flowControlConnection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
 MessageConsumer consumer = session.createConsumer(queueA);
 // Test sending to Queue B it should not block.
 CountDownLatch pubishDoneToQeueuA = asyncSendTo(queueA, "Message 1");
 assertTrue(pubishDoneToQeueuA.await(2, TimeUnit.SECONDS));
 TextMessage msg = (TextMessage) consumer.receive();
 assertEquals("Message 1", msg.getText());
 msg.acknowledge();
 pubishDoneToQeueuA = asyncSendTo(queueA, "Message 2");
 assertTrue(pubishDoneToQeueuA.await(2, TimeUnit.SECONDS));
 msg = (TextMessage) consumer.receive();
 assertEquals("Message 2", msg.getText());
 msg.acknowledge();
 consumer.close();
}
origin: apache/activemq-artemis

  ProxyAssertSupport.assertEquals("hello3", rm4.getText());
  rm4.acknowledge();
} finally {
  if (conn != null) {
origin: apache/activemq-artemis

@Test
public void test2ndPublisherWithSyncSendConnectionThatIsBlocked() throws Exception {
 factory.setAlwaysSyncSend(true);
 flowControlConnection = (ActiveMQConnection) factory.createConnection();
 flowControlConnection.start();
 Session session = flowControlConnection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
 MessageConsumer consumer = session.createConsumer(queueB);
 // Test sending to Queue A
 // 1st send should not block. But the rest will.
 fillQueue(queueA);
 // Test sending to Queue B it should not block.
 CountDownLatch pubishDoneToQeueuB = asyncSendTo(queueB, "Message 1");
 assertTrue(pubishDoneToQeueuB.await(2, TimeUnit.SECONDS));
 TextMessage msg = (TextMessage) consumer.receive();
 assertEquals("Message 1", msg.getText());
 msg.acknowledge();
 pubishDoneToQeueuB = asyncSendTo(queueB, "Message 2");
 assertTrue(pubishDoneToQeueuB.await(2, TimeUnit.SECONDS));
 msg = (TextMessage) consumer.receive();
 assertEquals("Message 2", msg.getText());
 msg.acknowledge();
 consumer.close();
}
origin: apache/activemq-artemis

@Test
public void test2ndPublisherWithProducerWindowSendConnectionThatIsBlocked() throws Exception {
 factory.setProducerWindowSize(1024 * 64);
 flowControlConnection = (ActiveMQConnection) factory.createConnection();
 flowControlConnection.start();
 Session session = flowControlConnection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
 MessageConsumer consumer = session.createConsumer(queueB);
 // Test sending to Queue A
 // 1 few sends should not block until the producer window is used up.
 fillQueue(queueA);
 // Test sending to Queue B it should not block since the connection
 // should not be blocked.
 CountDownLatch pubishDoneToQeueuB = asyncSendTo(queueB, "Message 1");
 assertTrue(pubishDoneToQeueuB.await(2, TimeUnit.SECONDS));
 TextMessage msg = (TextMessage) consumer.receive();
 assertEquals("Message 1", msg.getText());
 msg.acknowledge();
 pubishDoneToQeueuB = asyncSendTo(queueB, "Message 2");
 assertTrue(pubishDoneToQeueuB.await(2, TimeUnit.SECONDS));
 msg = (TextMessage) consumer.receive();
 assertEquals("Message 2", msg.getText());
 msg.acknowledge();
 consumer.close();
}
origin: apache/activemq-artemis

tm.acknowledge();
origin: apache/activemq-artemis

m.acknowledge();
Assert.assertEquals("m" + i, m.getText());
javax.jmsTextMessageacknowledge

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,
  • setJMSType,
  • getJMSDeliveryMode,
  • setObjectProperty,
  • getIntProperty,
  • getJMSPriority,
  • clearBody

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getSupportFragmentManager (FragmentActivity)
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • notifyDataSetChanged (ArrayAdapter)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • FileWriter (java.io)
    Convenience class for writing character files. The constructors of this class assume that the defaul
  • InputStreamReader (java.io)
    An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
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