Search in sources :

Example 6 with ActiveMQTempTopic

use of org.apache.activemq.command.ActiveMQTempTopic in project activemq-artemis by apache.

the class RequestReplyTempDestRemovalAdvisoryRaceTest method noConsumerAdvisory.

private void noConsumerAdvisory() throws JMSException {
    for (BrokerItem item : brokers.values()) {
        ActiveMQConnectionFactory brokerAFactory = new ActiveMQConnectionFactory(item.broker.getTransportConnectorByScheme("tcp").getName() + "?jms.watchTopicAdvisories=false");
        Connection connection = brokerAFactory.createConnection();
        connection.start();
        connection.createSession(false, Session.AUTO_ACKNOWLEDGE).createConsumer(AdvisorySupport.getNoTopicConsumersAdvisoryTopic(new ActiveMQTempTopic(">"))).setMessageListener(new MessageListener() {

            @Override
            public void onMessage(Message message) {
                sendsWithNoConsumers.incrementAndGet();
            }
        });
    }
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) ActiveMQTextMessage(org.apache.activemq.command.ActiveMQTextMessage) Message(javax.jms.Message) TextMessage(javax.jms.TextMessage) ActiveMQTempTopic(org.apache.activemq.command.ActiveMQTempTopic) Connection(javax.jms.Connection) MessageListener(javax.jms.MessageListener)

Example 7 with ActiveMQTempTopic

use of org.apache.activemq.command.ActiveMQTempTopic in project activemq-artemis by apache.

the class RequestReplyTempDestRemovalAdvisoryRaceTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    responseReceived.set(0);
    respondentSendError.set(0);
    forwardFailures.set(0);
    sendsWithNoConsumers.set(0);
    networkConnectors.clear();
    advisoryConsumerConnections.clear();
    consumerDemandExists = new CountDownLatch(1);
    createBroker(new URI("broker:(tcp://localhost:0)/" + BROKER_A + "?persistent=false&useJmx=false")).setDedicatedTaskRunner(false);
    createBroker(new URI("broker:(tcp://localhost:0)/" + BROKER_B + "?persistent=false&useJmx=false")).setDedicatedTaskRunner(false);
    createBroker(new URI("broker:(tcp://localhost:0)/" + BROKER_C + "?persistent=false&useJmx=false")).setDedicatedTaskRunner(false);
    PolicyMap map = new PolicyMap();
    PolicyEntry defaultEntry = new PolicyEntry();
    defaultEntry.setSendAdvisoryIfNoConsumers(true);
    DeadLetterStrategy deadletterStrategy = new SharedDeadLetterStrategy();
    deadletterStrategy.setProcessNonPersistent(true);
    defaultEntry.setDeadLetterStrategy(deadletterStrategy);
    defaultEntry.setDispatchPolicy(new PriorityDispatchPolicy());
    map.put(new ActiveMQTempTopic(">"), defaultEntry);
    for (BrokerItem item : brokers.values()) {
        item.broker.setDestinationPolicy(map);
    }
}
Also used : PriorityDispatchPolicy(org.apache.activemq.broker.region.policy.PriorityDispatchPolicy) PolicyMap(org.apache.activemq.broker.region.policy.PolicyMap) ActiveMQTempTopic(org.apache.activemq.command.ActiveMQTempTopic) SharedDeadLetterStrategy(org.apache.activemq.broker.region.policy.SharedDeadLetterStrategy) DeadLetterStrategy(org.apache.activemq.broker.region.policy.DeadLetterStrategy) CountDownLatch(java.util.concurrent.CountDownLatch) SharedDeadLetterStrategy(org.apache.activemq.broker.region.policy.SharedDeadLetterStrategy) URI(java.net.URI) PolicyEntry(org.apache.activemq.broker.region.policy.PolicyEntry)

Aggregations

ActiveMQTempTopic (org.apache.activemq.command.ActiveMQTempTopic)7 URI (java.net.URI)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 Connection (javax.jms.Connection)1 Message (javax.jms.Message)1 MessageListener (javax.jms.MessageListener)1 TextMessage (javax.jms.TextMessage)1 ActiveMQConnectionFactory (org.apache.activemq.ActiveMQConnectionFactory)1 DeadLetterStrategy (org.apache.activemq.broker.region.policy.DeadLetterStrategy)1 PolicyEntry (org.apache.activemq.broker.region.policy.PolicyEntry)1 PolicyMap (org.apache.activemq.broker.region.policy.PolicyMap)1 PriorityDispatchPolicy (org.apache.activemq.broker.region.policy.PriorityDispatchPolicy)1 SharedDeadLetterStrategy (org.apache.activemq.broker.region.policy.SharedDeadLetterStrategy)1 ActiveMQDestination (org.apache.activemq.command.ActiveMQDestination)1 ActiveMQQueue (org.apache.activemq.command.ActiveMQQueue)1 ActiveMQTempQueue (org.apache.activemq.command.ActiveMQTempQueue)1 ActiveMQTextMessage (org.apache.activemq.command.ActiveMQTextMessage)1 ActiveMQTopic (org.apache.activemq.command.ActiveMQTopic)1