Пример #1
0
  protected void setUp() throws Exception {
    super.setUp();

    // Create Client
    _clientConnection = getConnection("guest", "guest");

    _clientConnection.start();

    Session clientSession = _clientConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);

    Queue queue = clientSession.createQueue("message-listener-test-queue");

    _consumer = clientSession.createConsumer(queue);

    // Create Producer

    Connection producerConnection = getConnection("guest", "guest");

    producerConnection.start();

    Session producerSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);

    MessageProducer producer = producerSession.createProducer(queue);

    for (int msg = 0; msg < MSG_COUNT; msg++) {
      producer.send(producerSession.createTextMessage("Message " + msg));
    }

    producerConnection.close();
  }
Пример #2
0
 protected void tearDown() throws Exception {
   if (_clientConnection != null) {
     _clientConnection.close();
   }
   super.tearDown();
 }