Java Code Examples for org.apache.activemq.ActiveMQConnection#createSession()

The following examples show how to use org.apache.activemq.ActiveMQConnection#createSession() . 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: MessageCompressionTest.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
private void sendTestMapMessage(ActiveMQConnectionFactory factory, String message) throws JMSException {
   ActiveMQConnection connection = (ActiveMQConnection) factory.createConnection();
   Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
   MessageProducer producer = session.createProducer(queue);
   MapMessage mapMessage = session.createMapMessage();

   mapMessage.setBoolean("boolean-type", true);
   mapMessage.setByte("byte-type", (byte) 10);
   mapMessage.setBytes("bytes-type", TEXT.getBytes());
   mapMessage.setChar("char-type", 'A');
   mapMessage.setDouble("double-type", 55.3D);
   mapMessage.setFloat("float-type", 79.1F);
   mapMessage.setInt("int-type", 37);
   mapMessage.setLong("long-type", 56652L);
   mapMessage.setObject("object-type", new String("VVVV"));
   mapMessage.setShort("short-type", (short) 333);
   mapMessage.setString("string-type", TEXT);

   producer.send(mapMessage);
   connection.close();
}
 
Example 2
Source File: BrokerRedeliveryTest.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
public void testNoScheduledRedeliveryOfExpired() throws Exception {
   startBroker(true);
   ActiveMQConnection consumerConnection = (ActiveMQConnection) createConnection();
   consumerConnection.start();
   Session consumerSession = consumerConnection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
   MessageConsumer consumer = consumerSession.createConsumer(destination);
   sendMessage(1500);
   Message message = consumer.receive(1000);
   assertNotNull("got message", message);

   // ensure there is another consumer to redispatch to
   MessageConsumer redeliverConsumer = consumerSession.createConsumer(destination);

   // allow consumed to expire so it gets redelivered
   TimeUnit.SECONDS.sleep(2);
   consumer.close();

   // should go to dlq as it has expired
   // validate DLQ
   MessageConsumer dlqConsumer = consumerSession.createConsumer(new ActiveMQQueue(SharedDeadLetterStrategy.DEFAULT_DEAD_LETTER_QUEUE_NAME));
   Message dlqMessage = dlqConsumer.receive(2000);
   assertNotNull("Got message from dql", dlqMessage);
   assertEquals("message matches", message.getStringProperty("data"), dlqMessage.getStringProperty("data"));
}
 
Example 3
Source File: AbortSlowAckConsumer0Test.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
@Test
public void testZeroPrefetchConsumerIsAborted() throws Exception {
   strategy.setMaxTimeSinceLastAck(2000); // Make it shorter

   ActiveMQConnection conn = (ActiveMQConnection) createConnectionFactory().createConnection();
   conn.setExceptionListener(this);
   connections.add(conn);

   Session sess = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
   final MessageConsumer consumer = sess.createConsumer(destination);
   assertNotNull(consumer);
   conn.start();
   startProducers(destination, 20);

   Message message = consumer.receive(5000);
   assertNotNull(message);

   TimeUnit.SECONDS.sleep(15);

   try {
      consumer.receive(5000);
      fail("Slow consumer not aborted.");
   } catch (Exception ex) {
   }
}
 
Example 4
Source File: MessageCompressionTest.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
private void sendTestStreamMessage(ActiveMQConnectionFactory factory, String message) throws JMSException {
   ActiveMQConnection connection = (ActiveMQConnection) factory.createConnection();
   Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
   MessageProducer producer = session.createProducer(queue);
   StreamMessage streamMessage = session.createStreamMessage();

   streamMessage.writeBoolean(true);
   streamMessage.writeByte((byte) 10);
   streamMessage.writeBytes(TEXT.getBytes());
   streamMessage.writeChar('A');
   streamMessage.writeDouble(55.3D);
   streamMessage.writeFloat(79.1F);
   streamMessage.writeInt(37);
   streamMessage.writeLong(56652L);
   streamMessage.writeObject(new String("VVVV"));
   streamMessage.writeShort((short) 333);
   streamMessage.writeString(TEXT);

   producer.send(streamMessage);
   connection.close();
}
 
Example 5
Source File: MessageCompressionTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
private ActiveMQMapMessage receiveTestMapMessage(ActiveMQConnectionFactory factory) throws JMSException {
   ActiveMQConnection connection = (ActiveMQConnection) factory.createConnection();
   connection.start();
   Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
   MessageConsumer consumer = session.createConsumer(queue);
   ActiveMQMapMessage rc = (ActiveMQMapMessage) consumer.receive();
   connection.close();
   return rc;
}
 
Example 6
Source File: SimpleAuthenticationPluginTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
public void testSecurityContextClearedOnPurge() throws Exception {

      connection.close();
      ActiveMQConnectionFactory tcpFactory = new ActiveMQConnectionFactory(broker.getTransportConnectors().get(0).getPublishableConnectString());
      ActiveMQConnection conn = (ActiveMQConnection) tcpFactory.createConnection("user", "password");
      Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      conn.start();

      final int numDests = broker.getRegionBroker().getDestinations().length;
      for (int i = 0; i < 10; i++) {
         MessageProducer p = sess.createProducer(new ActiveMQQueue("USERS.PURGE." + i));
         p.close();
      }

      assertTrue("dests are purged", Wait.waitFor(new Wait.Condition() {
         @Override
         public boolean isSatisified() throws Exception {
            LOG.info("dests, orig: " + numDests + ", now: " + broker.getRegionBroker().getDestinations().length);
            return (numDests + 1) == broker.getRegionBroker().getDestinations().length;
         }
      }));

      // verify removed from connection security context
      TransportConnection brokerConnection = broker.getTransportConnectors().get(0).getConnections().get(0);
      TransportConnectionState transportConnectionState = brokerConnection.lookupConnectionState(conn.getConnectionInfo().getConnectionId());
      assertEquals("no destinations", 0, transportConnectionState.getContext().getSecurityContext().getAuthorizedWriteDests().size());
   }
 
Example 7
Source File: BrokerRedeliveryTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
private void sendMessage(int timeToLive) throws Exception {
   ActiveMQConnection producerConnection = (ActiveMQConnection) createConnection();
   producerConnection.start();
   Session producerSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
   MessageProducer producer = producerSession.createProducer(destination);
   if (timeToLive > 0) {
      producer.setTimeToLive(timeToLive);
   }
   Message message = producerSession.createMessage();
   message.setStringProperty("data", data);
   producer.send(message);
   producerConnection.close();
}
 
Example 8
Source File: AbortSlowAckConsumer0Test.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
@Test
public void testIdleConsumerCanBeAbortedNoMessages() throws Exception {
   strategy.setIgnoreIdleConsumers(false);
   strategy.setMaxTimeSinceLastAck(2000); // Make it shorter

   ActiveMQConnection conn = (ActiveMQConnection) createConnectionFactory().createConnection();
   conn.setExceptionListener(this);
   connections.add(conn);

   Session sess = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
   final MessageConsumer consumer = sess.createConsumer(destination);
   assertNotNull(consumer);
   conn.start();

   startProducers(destination, 1);

   Message message = consumer.receive(5000);
   assertNotNull(message);

   // Consumer needs to be closed before the receive call.
   TimeUnit.SECONDS.sleep(15);

   try {
      consumer.receive(5000);
      fail("Idle consumer not aborted.");
   } catch (Exception ex) {
   }
}
 
Example 9
Source File: DurableSubscriptionSelectorTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
private void openConsumer() throws Exception {
   consumerConnection = (ActiveMQConnection) createConnection();
   consumerConnection.setClientID("cliID");
   consumerConnection.start();
   Session session = consumerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
   TopicSubscriber subscriber = session.createDurableSubscriber(topic, "subName", "filter=true", false);

   subscriber.setMessageListener(new MessageListener() {
      @Override
      public void onMessage(Message message) {
         received++;
      }
   });
}
 
Example 10
Source File: MessageCompressionTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
private void sendTestBytesMessage(ActiveMQConnectionFactory factory,
                                  String message) throws JMSException, UnsupportedEncodingException {
   ActiveMQConnection connection = (ActiveMQConnection) factory.createConnection();
   Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
   MessageProducer producer = session.createProducer(queue);
   BytesMessage bytesMessage = session.createBytesMessage();
   bytesMessage.writeBytes(message.getBytes(StandardCharsets.UTF_8));
   producer.send(bytesMessage);
   connection.close();
}
 
Example 11
Source File: FailoverConsumerOutstandingCommitTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
private Message receiveMessage(ActiveMQConnectionFactory cf, Queue destination) throws Exception {
   final ActiveMQConnection connection = (ActiveMQConnection) cf.createConnection();
   connection.start();
   final Session consumerSession = connection.createSession(true, Session.SESSION_TRANSACTED);
   final MessageConsumer consumer = consumerSession.createConsumer(destination);
   Message msg = consumer.receive(5000);
   consumerSession.commit();
   connection.close();
   return msg;
}
 
Example 12
Source File: MessageCompressionTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
private ActiveMQStreamMessage receiveTestStreamMessage(ActiveMQConnectionFactory factory) throws JMSException {
   ActiveMQConnection connection = (ActiveMQConnection) factory.createConnection();
   connection.start();
   Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
   MessageConsumer consumer = session.createConsumer(queue);
   ActiveMQStreamMessage rc = (ActiveMQStreamMessage) consumer.receive();
   connection.close();
   return rc;
}
 
Example 13
Source File: FailoverClusterTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
protected void createClients() throws Exception {
   ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(clientUrl);
   for (int i = 0; i < NUMBER; i++) {
      System.out.println("*****create connection using url: " + clientUrl);
      ActiveMQConnection c = (ActiveMQConnection) factory.createConnection();
      System.out.println("got connection, starting it ...");
      c.start();
      System.out.println("******Started");
      Session s = c.createSession(false, Session.AUTO_ACKNOWLEDGE);
      Queue queue = s.createQueue(getClass().getName());
      MessageConsumer consumer = s.createConsumer(queue);
      connections.add(c);
   }
}
 
Example 14
Source File: TwoBrokerTempQueueAdvisoryTest.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
public void testSendToRemovedTemp() throws Exception {

      ActiveMQQueue requestReplyDest = new ActiveMQQueue("RequestReply");

      NetworkConnector nc = bridgeBrokers("BrokerA", "BrokerB");
      if (useDuplex) {
         nc.setDuplex(true);
      } else {
         bridgeBrokers("BrokerB", "BrokerA");
      }

      // destination advisory can loose the race with message dispatch, so we need to allow replies on network broker
      // to work in the absence of an advisory, the destination will be cleaned up in the normal
      // way
      if (!useDuplex) {
         brokers.get("BrokerB").broker.setAllowTempAutoCreationOnSend(true);
      }

      TransportConnector forClient = brokers.get("BrokerA").broker.addConnector("tcp://localhost:0");
      startAllBrokers();
      waitForBridgeFormation();
      waitForMinTopicRegionConsumerCount("BrokerB", 1);
      waitForMinTopicRegionConsumerCount("BrokerA", 1);

      ConnectionFactory factory = new ActiveMQConnectionFactory(forClient.getConnectUri());
      ActiveMQConnection conn = (ActiveMQConnection) factory.createConnection();
      conn.setWatchTopicAdvisories(false);
      conn.start();
      Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);

      ConnectionFactory replyFactory = getConnectionFactory("BrokerB");
      for (int i = 0; i < 500; i++) {
         TemporaryQueue tempDest = session.createTemporaryQueue();
         MessageProducer producer = session.createProducer(requestReplyDest);
         javax.jms.Message message = session.createTextMessage("req-" + i);
         message.setJMSReplyTo(tempDest);

         ActiveMQMessageConsumer consumer = (ActiveMQMessageConsumer) session.createConsumer(tempDest);
         producer.send(message);

         ActiveMQConnection replyConnection = (ActiveMQConnection) replyFactory.createConnection();
         replyConnection.setWatchTopicAdvisories(false);
         replyConnection.start();
         Session replySession = replyConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
         ActiveMQMessageConsumer replyConsumer = (ActiveMQMessageConsumer) replySession.createConsumer(requestReplyDest);
         javax.jms.Message msg = replyConsumer.receive(10000);
         assertNotNull("request message not null: " + i, msg);
         MessageProducer replyProducer = replySession.createProducer(msg.getJMSReplyTo());
         replyProducer.send(session.createTextMessage("reply-" + i));
         replyConnection.close();

         javax.jms.Message reply = consumer.receive(10000);
         assertNotNull("reply message : " + i + ", to: " + tempDest + ", by consumer:" + consumer.getConsumerId(), reply);
         consumer.close();
         tempDest.delete();
      }
   }
 
Example 15
Source File: ActiveMQClientITHelper.java    From pinpoint with Apache License 2.0 4 votes vote down vote up
public static ActiveMQSession createSession(String brokerName, String brokerUrl, boolean transacted, int acknowledgeMode) throws JMSException {
    ActiveMQConnection connection = BROKER_SERVICE.getConnection(brokerName, brokerUrl);
    return (ActiveMQSession) connection.createSession(transacted, acknowledgeMode);
}
 
Example 16
Source File: FailoverPrefetchZeroTest.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
@Test
@BMRules(
   rules = {@BMRule(
      name = "set no return response and stop the broker",
      targetClass = "org.apache.activemq.artemis.core.protocol.openwire.OpenWireConnection$CommandProcessor",
      targetMethod = "processMessagePull",
      targetLocation = "ENTRY",
      action = "org.apache.activemq.transport.failover.FailoverPrefetchZeroTest.holdResponseAndStopBroker($0)")})
public void testPrefetchZeroConsumerThroughRestart() throws Exception {
   broker = createBroker();
   broker.start();
   doByteman.set(true);

   ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("failover:(" + url + ")");
   cf.setWatchTopicAdvisories(false);

   final ActiveMQConnection connection = (ActiveMQConnection) cf.createConnection();
   connection.start();

   final Session consumerSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
   final Queue destination = consumerSession.createQueue(QUEUE_NAME + "?consumer.prefetchSize=" + prefetch);

   final MessageConsumer consumer = consumerSession.createConsumer(destination);
   produceMessage(consumerSession, destination, 1);

   final CountDownLatch receiveDone = new CountDownLatch(1);
   final Vector<Message> received = new Vector<>();
   new Thread() {
      @Override
      public void run() {
         try {
            LOG.info("receive one...");
            Message msg = consumer.receive(30000);
            if (msg != null) {
               received.add(msg);
            }
            receiveDone.countDown();
            LOG.info("done receive");
         } catch (Exception e) {
            e.printStackTrace();
         }
      }
   }.start();

   // will be stopped by the plugin
   assertTrue("pull completed on broker", pullDone.await(30, TimeUnit.SECONDS));
   brokerStopLatch.await();
   doByteman.set(false);
   broker = createBroker();
   broker.start();

   assertTrue("receive completed through failover", receiveDone.await(30, TimeUnit.SECONDS));

   assertTrue("we got our message:", !received.isEmpty());

   connection.close();
}
 
Example 17
Source File: NonBlockingConsumerRedeliveryTest.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
@Test
public void testNonBlockingMessageDeleiveryIsDelayed() throws Exception {
   final LinkedHashSet<Message> received = new LinkedHashSet<>();

   ActiveMQConnection connection = (ActiveMQConnection) connectionFactory.createConnection();
   connection.getRedeliveryPolicy().setInitialRedeliveryDelay(TimeUnit.SECONDS.toMillis(6));
   Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
   Destination destination = session.createQueue(destinationName);
   MessageConsumer consumer = session.createConsumer(destination);

   consumer.setMessageListener(new MessageListener() {
      @Override
      public void onMessage(Message message) {
         received.add(message);
      }
   });

   sendMessages();
   connection.start();

   assertTrue("Pre-Rollback expects to receive: " + MSG_COUNT + " messages.", Wait.waitFor(new Wait.Condition() {
      @Override
      public boolean isSatisified() throws Exception {
         LOG.info("Consumer has received " + received.size() + " messages.");
         return received.size() == MSG_COUNT;
      }
   }));

   received.clear();
   session.rollback();

   assertFalse("Delayed redelivery test not expecting any messages yet.", Wait.waitFor(new Wait.Condition() {
      @Override
      public boolean isSatisified() throws Exception {
         return received.size() > 0;
      }
   }, TimeUnit.SECONDS.toMillis(4)));

   session.commit();
   session.close();
}
 
Example 18
Source File: FailoverConsumerOutstandingCommitTest.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
@Test
public void testRollbackFailoverConsumerTx() throws Exception {
   server = createBroker();
   server.start();

   ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("failover:(" + url + ")");
   cf.setConsumerFailoverRedeliveryWaitPeriod(10000);
   final ActiveMQConnection connection = (ActiveMQConnection) cf.createConnection();
   connection.start();

   final Session producerSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
   final Queue destination = producerSession.createQueue(QUEUE_NAME);

   final Session consumerSession = connection.createSession(true, Session.SESSION_TRANSACTED);
   final MessageConsumer testConsumer = consumerSession.createConsumer(destination);
   assertNull("no message yet", testConsumer.receiveNoWait());

   produceMessage(producerSession, destination, 1);
   producerSession.close();

   // consume then rollback after restart
   Message msg = testConsumer.receive(5000);
   assertNotNull(msg);

   // restart with outstanding delivered message
   server.stop();
   server = createBroker();
   server.start();

   consumerSession.rollback();

   // receive again
   msg = testConsumer.receive(10000);
   assertNotNull("got message again after rollback", msg);

   consumerSession.commit();

   // close before sweep
   consumerSession.close();
   msg = receiveMessage(cf, destination);
   assertNull("should be nothing left after commit", msg);
   connection.close();
}
 
Example 19
Source File: BrokerRedeliveryTest.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
public void doTestScheduledRedelivery(int maxBrokerRedeliveriesToValidate, boolean validateDLQ) throws Exception {

      startBroker(true);
      sendMessage(0);

      ActiveMQConnection consumerConnection = (ActiveMQConnection) createConnection();
      RedeliveryPolicy redeliveryPolicy = new RedeliveryPolicy();
      redeliveryPolicy.setInitialRedeliveryDelay(0);
      redeliveryPolicy.setMaximumRedeliveries(0);
      consumerConnection.setRedeliveryPolicy(redeliveryPolicy);
      consumerConnection.start();
      Session consumerSession = consumerConnection.createSession(true, Session.SESSION_TRANSACTED);
      MessageConsumer consumer = consumerSession.createConsumer(destination);
      Message message = consumer.receive(1000);
      assertNotNull("got message", message);
      LOG.info("got: " + message);
      consumerSession.rollback();

      for (int i = 0; i < maxBrokerRedeliveriesToValidate; i++) {
         Message shouldBeNull = consumer.receive(500);
         assertNull("did not get message after redelivery count exceeded: " + shouldBeNull, shouldBeNull);

         TimeUnit.SECONDS.sleep(3);

         Message brokerRedeliveryMessage = consumer.receive(500);
         LOG.info("got: " + brokerRedeliveryMessage);
         assertNotNull("got message via broker redelivery after delay", brokerRedeliveryMessage);
         assertEquals("message matches", message.getStringProperty("data"), brokerRedeliveryMessage.getStringProperty("data"));
         assertEquals("has expiryDelay specified", i == 0 ? initialRedeliveryDelayMillis : redeliveryDelayMillis, brokerRedeliveryMessage.getLongProperty(RedeliveryPlugin.REDELIVERY_DELAY));

         consumerSession.rollback();
      }

      if (validateDLQ) {
         MessageConsumer dlqConsumer = consumerSession.createConsumer(new ActiveMQQueue(SharedDeadLetterStrategy.DEFAULT_DEAD_LETTER_QUEUE_NAME));
         Message dlqMessage = dlqConsumer.receive(2000);
         assertNotNull("Got message from dql", dlqMessage);
         assertEquals("message matches", message.getStringProperty("data"), dlqMessage.getStringProperty("data"));
         consumerSession.commit();
      } else {
         // consume/commit ok
         message = consumer.receive(3000);
         assertNotNull("got message", message);
         assertEquals("redeliveries accounted for", maxBrokerRedeliveriesToValidate + 2, message.getLongProperty("JMSXDeliveryCount"));
         consumerSession.commit();
      }

      consumerConnection.close();
   }
 
Example 20
Source File: TwoSecureBrokerRequestReplyTest.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
public void testRequestReply() throws Exception {
   ActiveMQQueue requestReplyDest = new ActiveMQQueue("RequestReply");

   startAllBrokers();
   waitForBridgeFormation();
   waitForMinTopicRegionConsumerCount("sender", 1);
   waitForMinTopicRegionConsumerCount("receiver", 1);

   ConnectionFactory factory = getConnectionFactory("sender");
   ActiveMQConnection conn = (ActiveMQConnection) factory.createConnection("system", "manager");
   conn.setWatchTopicAdvisories(false);
   conn.start();
   Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);

   ConnectionFactory replyFactory = getConnectionFactory("receiver");
   for (int i = 0; i < 2000; i++) {
      TemporaryQueue tempDest = session.createTemporaryQueue();
      MessageProducer producer = session.createProducer(requestReplyDest);
      javax.jms.Message message = session.createTextMessage("req-" + i);
      message.setJMSReplyTo(tempDest);

      ActiveMQMessageConsumer consumer = (ActiveMQMessageConsumer) session.createConsumer(tempDest);
      producer.send(message);

      ActiveMQConnection replyConnection = (ActiveMQConnection) replyFactory.createConnection("system", "manager");
      replyConnection.setWatchTopicAdvisories(false);
      replyConnection.start();
      Session replySession = replyConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
      ActiveMQMessageConsumer replyConsumer = (ActiveMQMessageConsumer) replySession.createConsumer(requestReplyDest);
      javax.jms.Message msg = replyConsumer.receive(10000);
      assertNotNull("request message not null: " + i, msg);
      MessageProducer replyProducer = replySession.createProducer(msg.getJMSReplyTo());
      replyProducer.send(session.createTextMessage("reply-" + i));
      replyConnection.close();

      javax.jms.Message reply = consumer.receive(10000);
      assertNotNull("reply message : " + i + ", to: " + tempDest + ", by consumer:" + consumer.getConsumerId(), reply);
      consumer.close();
      tempDest.delete();
      LOG.info("message #" + i + " processed");
   }

}