Package org.apache.activemq.broker.region

Examples of org.apache.activemq.broker.region.Destination


        // give a sec to let advisories propogate
        Thread.sleep(500);

        ActiveMQQueue queueA = new ActiveMQQueue("Consumer.A.VirtualTopic.tempTopic");
        Destination destination = getDestination(brokers.get("BrokerA").broker, queueA);
        assertEquals(1, destination.getConsumers().size());

        ActiveMQQueue queueB = new ActiveMQQueue("Consumer.B.VirtualTopic.tempTopic");
        destination = getDestination(brokers.get("BrokerA").broker, queueB);
        assertNull(destination);
View Full Code Here


        // give a sec to let advisories propogate
        Thread.sleep(500);

        ActiveMQQueue queueA = new ActiveMQQueue("Consumer.A.VirtualTopic.tempTopic");
        Destination destination = getDestination(brokers.get("BrokerA").broker, queueA);
        assertEquals(1, destination.getConsumers().size());

        ActiveMQQueue queueB = new ActiveMQQueue("Consumer.B.VirtualTopic.tempTopic");
        destination = getDestination(brokers.get("BrokerA").broker, queueB);
        assertNull(destination);
View Full Code Here

        producer.join();

        Thread.sleep(1000);

        // assert we didn't break high watermark (70%) usage
        final Destination dest = broker.getDestination((ActiveMQQueue) queue);
        LOG.info("Destination usage: " + dest.getMemoryUsage());
        int percentUsage = dest.getMemoryUsage().getPercentUsage();
        assertTrue("Should be less than 70% of limit but was: " + percentUsage, percentUsage <= 71);
        LOG.info("Broker usage: " + broker.getSystemUsage().getMemoryUsage());
        assertTrue(broker.getSystemUsage().getMemoryUsage().getPercentUsage() <= 71);

        // consume one message
        MessageConsumer consumer = sess.createConsumer(queue);
        Message msg = consumer.receive();
        msg.acknowledge();

        // this should free some space and allow us to get new batch of messages in the memory
        // exceeding the limit
        assertTrue("Limit is exceeded", Wait.waitFor(new Wait.Condition() {
            @Override
            public boolean isSatisified() throws Exception {
                LOG.info("Destination usage: " + dest.getMemoryUsage());
                return dest.getMemoryUsage().getPercentUsage() >= 478;
            }
        }));

        LOG.info("Broker usage: " + broker.getSystemUsage().getMemoryUsage());
        assertTrue(broker.getSystemUsage().getMemoryUsage().getPercentUsage() >= 478);
View Full Code Here

        final SecurityContext securityContext = (SecurityContext)context.getSecurityContext();
        if (securityContext == null) {
            throw new SecurityException("User is not authenticated.");
        }
       
        Destination existing = this.getDestinationMap().get(destination);
        if (existing != null) {
          return super.addDestination(context, destination);
        }
       
        if (!securityContext.isBrokerContext()) {
View Full Code Here

        broker.getAdminView().removeQueue(DESTINATION_NAME_2);

        LOG.info("Recreating destination: {}", DESTINATION_NAME_2);
        sendMessage(DESTINATION_NAME_2, "test 1");

        Destination destination2 = broker.getDestination(new ActiveMQQueue(DESTINATION_NAME_2));
        assertNotNull(destination2);
        assertEquals(1, destination2.getMessageStore().getMessageCount());
    }
View Full Code Here

            producers.put(info.getProducerId(), info);
        }
    }

    public Destination addDestination(ConnectionContext context, ActiveMQDestination destination) throws Exception {
        Destination answer = super.addDestination(context, destination);
        if (!AdvisorySupport.isAdvisoryTopic(destination)) {
            DestinationInfo info = new DestinationInfo(context.getConnectionId(), DestinationInfo.ADD_OPERATION_TYPE, destination);
            DestinationInfo previous = destinations.putIfAbsent(destination, info);
            if( previous==null ) {
                ActiveMQTopic topic = AdvisorySupport.getDestinationAdvisoryTopic(destination);
View Full Code Here

            subscriber.close();
            subscriberSession.close();
        }
        connection.close();
        Thread.sleep(1000);
        Destination dest = backEnd.getRegionBroker().getDestinationMap().get(topic);
        assertNotNull(dest);
        assertTrue(dest.getConsumers().isEmpty());
    }
View Full Code Here

            subscriber.close();
        }
        subscriberSession.close();
        connection.close();
        Thread.sleep(1000);
        Destination dest = backEnd.getRegionBroker().getDestinationMap().get(topic);
        assertNotNull(dest);
        assertTrue(dest.getConsumers().isEmpty());

    }
View Full Code Here

        subscriber.setMessageListener(listener);
        subscriber.close();
        subscriberSession.close();
        connection.close();
        Thread.sleep(1000);
        Destination dest = backEnd.getRegionBroker().getDestinationMap().get(topic);
        assertNotNull(dest);
        assertTrue(dest.getConsumers().isEmpty());
    }
View Full Code Here

            assertNotNull(subscriber);
        }

        connection.close();
        Thread.sleep(1000);
        Destination dest = backEnd.getRegionBroker().getDestinationMap().get(topic);
        assertNotNull(dest);
        assertTrue(dest.getConsumers().isEmpty());
    }
View Full Code Here

TOP

Related Classes of org.apache.activemq.broker.region.Destination

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.