Package org.apache.activemq.broker.region

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


        super(broker,destinationStatistics, memoryManager, taskRunnerFactory, destinationFactory);
        regionBroker = broker;
    }

    protected Subscription createSubscription(ConnectionContext context, ConsumerInfo info) throws JMSException {
        Subscription sub = super.createSubscription(context, info);
        ObjectName name = regionBroker.registerSubscription(context,sub);
        sub.setObjectName(name);
        return sub;
    }
View Full Code Here


    public ObjectName getSubscriberObjectName(Subscription key) {
        return subscriptionMap.get(key);
    }

    public Subscription getSubscriber(ObjectName key) {
        Subscription sub = null;
        for (Entry<Subscription, ObjectName> entry: subscriptionMap.entrySet()) {
            if (entry.getValue().equals(key)) {
                sub = entry.getKey();
                break;
            }
View Full Code Here

        // Everyone sees the same order and that the consumer list is not used while
        // it's being rotated.
        synchronized(consumers) {
            int count = 0;
           
            Subscription firstMatchingConsumer = null;
            for (Iterator iter = consumers.iterator(); iter.hasNext();) {
                Subscription sub = (Subscription) iter.next();
               
                // Only dispatch to interested subscriptions
                if (!sub.matches(node, msgContext))
                    continue;
               
                if (firstMatchingConsumer == null) {
                    firstMatchingConsumer = sub;
                }             
                sub.add(node);
                count++;
            }
           

            if (firstMatchingConsumer != null) {
View Full Code Here

        // Big synch here so that only 1 message gets dispatched at a time.  Ensures
        // Everyone sees the same order.
        synchronized(consumers) {
            int count = 0;
            for (Iterator iter = consumers.iterator(); iter.hasNext();) {
                Subscription sub = (Subscription) iter.next();
               
                // Only dispatch to interested subscriptions
                if (!sub.matches(node, msgContext))
                    continue;
               
                sub.add(node);
                count++;
            }
            return count > 0;
        }
    }
View Full Code Here

        super(regionBroker, destinationStatistics, memoryManager, taskRunnerFactory, destinationFactory);
        this.regionBroker = regionBroker;
    }
   
    protected Subscription createSubscription(ConnectionContext context, ConsumerInfo info) throws JMSException {
        Subscription sub = super.createSubscription(context, info);
        ObjectName name = regionBroker.registerSubscription(context,sub);
        sub.setObjectName(name);
        return sub;
    }
View Full Code Here

            brokers[i].addConnection(context,info);
        }
    }

    public Subscription addConsumer(ConnectionContext context,ConsumerInfo info) throws Exception{
        Subscription answer = next.addConsumer(context,info);
        Broker brokers[]=getListeners();
        for(int i=0;i<brokers.length;i++){
            brokers[i].addConsumer(context,info);
        }
        return answer;
View Full Code Here

        brokerView = (BrokerViewMBean) MBeanServerInvocationHandler.newProxyInstance(mbeanServer, brokerName,
                BrokerViewMBean.class, true);
    }

    public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception {
        Subscription answer = super.addConsumer(context, info);
        generateFile();
        return answer;
    }
View Full Code Here

public class SimpleDispatchPolicy implements DispatchPolicy {

    public boolean dispatch(ConnectionContext context, MessageReference node, MessageEvaluationContext msgContext, List consumers) throws Exception {
        int count = 0;
        for (Iterator iter = consumers.iterator(); iter.hasNext();) {
            Subscription sub = (Subscription) iter.next();
           
            // Don't deliver to browsers
            if( sub.getConsumerInfo().isBrowser() )
                continue;
            // Only dispatch to interested subscriptions
            if (!sub.matches(node, msgContext))
                continue;
           
            sub.add(node);
            count++;
        }
        return count > 0;
    }
View Full Code Here

        consumerId.setValue(0);
        info.setConsumerId(consumerId);
        info.setDestination(new ActiveMQTopic(topicName));
        info.setSubscriptionName(subscriberName);
        info.setSelector(selector);
        Subscription subscription = broker.addConsumer(context, info);
        broker.removeConsumer(context, info);
        if (subscription != null) {
            return subscription.getObjectName();
        }
        return null;
    }
View Full Code Here

     * @return the assocated subscription
     * @throws Exception
     */
    public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception {
        sendAsyncToSlave(info);
        Subscription answer = super.addConsumer(context, info);
       
        return answer;
    }
View Full Code Here

TOP

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

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.