Exemplo n.º 1
0
  /** Connects to a named queue. */
  public JMSQueue(ConnectionFactory connectionFactory, Destination queue) throws Exception {
    _connection = connectionFactory.createConnection();

    _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

    if (queue == null) _destination = _session.createTemporaryQueue();
    else _destination = queue;

    _consumer = _session.createConsumer(_destination);
    _producer = _session.createProducer(_destination);

    _connection.start();
  }
Exemplo n.º 2
0
 protected void finalize() {
   try {
     _connection.close();
   } catch (JMSException e) {
     // intentionally left empty
   }
 }