Package org.apache.activemq.broker.region

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


        return result;
    }

    protected void waitForMinTopicRegionConsumerCount(final String name, final int count) throws Exception {
        final BrokerService broker = brokers.get(name).broker;
        final TopicRegion topicRegion =  (TopicRegion) ((RegionBroker) broker.getRegionBroker()).getTopicRegion();
        assertTrue("found expected consumers in topic region of" + name, Wait.waitFor(new Wait.Condition() {
            @Override
            public boolean isSatisified() throws Exception {
                LOG.info("topic consumers: " + name +", " +  topicRegion.getSubscriptions().toString());
                return topicRegion.getSubscriptions().size()  >= count;
            }
        }));
    }
View Full Code Here


        return result;
    }

    protected void waitForMinTopicRegionConsumerCount(final String name, final int count) throws Exception {
        final BrokerService broker = brokers.get(name).broker;
        final TopicRegion topicRegion =  (TopicRegion) ((RegionBroker) broker.getRegionBroker()).getTopicRegion();
        assertTrue("found expected consumers in topic region of" + name, Wait.waitFor(new Wait.Condition() {
            @Override
            public boolean isSatisified() throws Exception {
                LOG.info("topic consumers: " + name +", " +  topicRegion.getSubscriptions().toString());
                return topicRegion.getSubscriptions().size()  >= count;
            }
        }));
    }
View Full Code Here

        return result;
    }

    protected void waitForMinTopicRegionConsumerCount(final String name, final int count) throws Exception {
        final BrokerService broker = brokers.get(name).broker;
        final TopicRegion topicRegion =  (TopicRegion) ((RegionBroker) broker.getRegionBroker()).getTopicRegion();
        assertTrue("found expected consumers in topic region of" + name, Wait.waitFor(new Wait.Condition() {
            @Override
            public boolean isSatisified() throws Exception {
                LOG.info("topic consumers: " + name +", " +  topicRegion.getSubscriptions().toString());
                return topicRegion.getSubscriptions().size()  >= count;
            }
        }));
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    private ConcurrentHashMap<SubscriptionKey, DurableTopicSubscription> getDurableSubscriptions() throws NoSuchFieldException, IllegalAccessException {
        if(durableSubscriptions!=null) return durableSubscriptions;
        RegionBroker regionBroker=(RegionBroker)service.getRegionBroker();
        TopicRegion region=(TopicRegion)regionBroker.getTopicRegion();
        Field field=TopicRegion.class.getDeclaredField("durableSubscriptions");
        field.setAccessible(true);
        durableSubscriptions=(ConcurrentHashMap<SubscriptionKey, DurableTopicSubscription>)field.get(region);
        return durableSubscriptions;
    }
View Full Code Here

    }

    private ConcurrentHashMap<SubscriptionKey, DurableTopicSubscription> getDurableSubscriptions() throws NoSuchFieldException, IllegalAccessException {
        if(durableSubscriptions!=null) return durableSubscriptions;
        RegionBroker regionBroker=(RegionBroker)service.getRegionBroker();
        TopicRegion region=(TopicRegion)regionBroker.getTopicRegion();
        Field field=TopicRegion.class.getDeclaredField("durableSubscriptions");
        field.setAccessible(true);
        durableSubscriptions=(ConcurrentHashMap<SubscriptionKey, DurableTopicSubscription>)field.get(region);
        return durableSubscriptions;
    }
View Full Code Here

        try {
            regionBroker = (RegionBroker) brokerService.getBroker().getAdaptor(RegionBroker.class);
        } catch (Exception e) {
            throw new MQTTProtocolException("Error subscribing to " + topicName + ": " + e.getMessage(), false, e);
        }
        final TopicRegion topicRegion = (TopicRegion) regionBroker.getTopicRegion();

        final ConsumerInfo consumerInfo = mqttSubscription.getConsumerInfo();
        final ConsumerId consumerId = consumerInfo.getConsumerId();

        // use actual client id used to create connection to lookup connection
        // context
        final String connectionInfoClientId = protocol.getClientId();
        final ConnectionContext connectionContext = regionBroker.getConnectionContext(connectionInfoClientId);

        // get all matching Topics
        final Set<org.apache.activemq.broker.region.Destination> matchingDestinations =
            topicRegion.getDestinations(mqttSubscription.getDestination());
        for (org.apache.activemq.broker.region.Destination dest : matchingDestinations) {

            // recover retroactive messages for matching subscription
            for (Subscription subscription : dest.getConsumers()) {
                if (subscription.getConsumerInfo().getConsumerId().equals(consumerId)) {
View Full Code Here

        try {
            regionBroker = (RegionBroker) brokerService.getBroker().getAdaptor(RegionBroker.class);
        } catch (Exception e) {
            throw new MQTTProtocolException("Error subscribing to " + topicName + ": " + e.getMessage(), false, e);
        }
        final TopicRegion topicRegion = (TopicRegion) regionBroker.getTopicRegion();

        final ConsumerInfo consumerInfo = mqttSubscription.getConsumerInfo();
        final ConsumerId consumerId = consumerInfo.getConsumerId();

        // use actual client id used to create connection to lookup connection context
        final String connectionInfoClientId = connectionInfo.getClientId();
        final ConnectionContext connectionContext = regionBroker.getConnectionContext(connectionInfoClientId);

        // get all matching Topics
        final Set<org.apache.activemq.broker.region.Destination> matchingDestinations = topicRegion.getDestinations(destination);
        for (org.apache.activemq.broker.region.Destination dest : matchingDestinations) {

            // recover retroactive messages for matching subscription
            for (Subscription subscription : dest.getConsumers()) {
                if (subscription.getConsumerInfo().getConsumerId().equals(consumerId)) {
View Full Code Here

TOP

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

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.