org.apache.activemq.command.ActiveMQTempQueue

Here are the examples of the java api class org.apache.activemq.command.ActiveMQTempQueue taken from open source projects.

1. ActiveMQTempQueueTest#createObject()

View license
@Override
public Object createObject() throws Exception {
    ActiveMQTempQueue info = new ActiveMQTempQueue();
    populateObject(info);
    return info;
}

2. ActiveMQTempQueueTest#populateObject()

View license
@Override
protected void populateObject(Object object) throws Exception {
    super.populateObject(object);
    ActiveMQTempQueue info = (ActiveMQTempQueue) object;
}

3. ActiveMQTempQueueTest#createObject()

View license
@Override
public Object createObject() throws Exception {
    ActiveMQTempQueue info = new ActiveMQTempQueue();
    populateObject(info);
    return info;
}

4. ActiveMQTempQueueTest#populateObject()

View license
@Override
protected void populateObject(Object object) throws Exception {
    super.populateObject(object);
    ActiveMQTempQueue info = (ActiveMQTempQueue) object;
}

5. RequestReplyNoAdvisoryNetworkTest#doTestNonAdvisoryNetworkRequestReply()

View license
public void doTestNonAdvisoryNetworkRequestReply() throws Exception {
    waitForBridgeFormation(a, 1, 0);
    waitForBridgeFormation(b, 1, 0);
    ActiveMQConnectionFactory sendFactory = createConnectionFactory(a);
    ActiveMQConnection sendConnection = createConnection(sendFactory);
    ActiveMQSession sendSession = (ActiveMQSession) sendConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    MessageProducer producer = sendSession.createProducer(sendQ);
    ActiveMQTempQueue realReplyQ = (ActiveMQTempQueue) sendSession.createTemporaryQueue();
    TextMessage message = sendSession.createTextMessage("1");
    message.setJMSReplyTo(realReplyQ);
    producer.send(message);
    LOG.info("request sent");
    // responder
    ActiveMQConnectionFactory consumerFactory = createConnectionFactory(b);
    ActiveMQConnection consumerConnection = createConnection(consumerFactory);
    ActiveMQSession consumerSession = (ActiveMQSession) consumerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    MessageConsumer consumer = consumerSession.createConsumer(sendQ);
    TextMessage received = (TextMessage) consumer.receive(receiveTimeout);
    assertNotNull("got request from sender ok", received);
    LOG.info("got request, sending reply");
    MessageProducer consumerProducer = consumerSession.createProducer(received.getJMSReplyTo());
    consumerProducer.send(consumerSession.createTextMessage("got " + received.getText()));
    // temp dest on reply broker tied to this connection, setOptimizedDispatch=true ensures
    // message gets delivered before destination is removed
    consumerConnection.close();
    // reply consumer
    MessageConsumer replyConsumer = sendSession.createConsumer(realReplyQ);
    TextMessage reply = (TextMessage) replyConsumer.receive(receiveTimeout);
    assertNotNull("expected reply message", reply);
    assertEquals("text is as expected", "got 1", reply.getText());
    sendConnection.close();
    LOG.info("checking for dangling temp destinations");
    // ensure all temp dests get cleaned up on all brokers
    for (BrokerService brokerService : brokers) {
        final RegionBroker regionBroker = (RegionBroker) brokerService.getRegionBroker();
        assertTrue("all temps are gone on " + regionBroker.getBrokerName(), Wait.waitFor(new Wait.Condition() {

            @Override
            public boolean isSatisified() throws Exception {
                Map<?, ?> tempTopics = regionBroker.getTempTopicRegion().getDestinationMap();
                LOG.info("temp topics on " + regionBroker.getBrokerName() + ", " + tempTopics);
                Map<?, ?> tempQ = regionBroker.getTempQueueRegion().getDestinationMap();
                LOG.info("temp queues on " + regionBroker.getBrokerName() + ", " + tempQ);
                return tempQ.isEmpty() && tempTopics.isEmpty();
            }
        }));
    }
}