Package org.apache.activemq.util

Examples of org.apache.activemq.util.SubscriptionKey


    @Override
    public void removeConsumer(ConnectionContext context, ConsumerInfo info) throws Exception {
        if (info.isDurable()) {

            SubscriptionKey key = new SubscriptionKey(context.getClientId(), info.getSubscriptionName());
            DurableTopicSubscription sub = durableSubscriptions.get(key);
            if (sub != null) {
                sub.deactivate(keepDurableSubsActive);
            }
View Full Code Here


        }
    }

    @Override
    public void removeSubscription(ConnectionContext context, RemoveSubscriptionInfo info) throws Exception {
        SubscriptionKey key = new SubscriptionKey(info.getClientId(), info.getSubscriptionName());
        DurableTopicSubscription sub = durableSubscriptions.get(key);
        if (sub == null) {
            throw new InvalidDestinationException("No durable subscription exists for: " + info.getSubscriptionName());
        }
        if (sub.isActive()) {
View Full Code Here

            SubscriptionInfo[] infos = store.getAllSubscriptions();
            for (int i = 0; i < infos.length; i++) {

                SubscriptionInfo info = infos[i];
                LOG.debug("Restoring durable subscription: " + info);
                SubscriptionKey key = new SubscriptionKey(info);

                // A single durable sub may be subscribing to multiple topics.
                // so it might exist already.
                DurableTopicSubscription sub = durableSubscriptions.get(key);
                ConsumerInfo consumerInfo = createInactiveConsumerInfo(info);
                if (sub == null) {
                    ConnectionContext c = new ConnectionContext();
                    c.setBroker(context.getBroker());
                    c.setClientId(key.getClientId());
                    c.setConnectionId(consumerInfo.getConsumerId().getParentId().getParentId());
                    sub = (DurableTopicSubscription)createSubscription(c, consumerInfo);
                }

                if (dupChecker.contains(sub)) {
View Full Code Here

       
        if (info.isDurable()) {
            if (AdvisorySupport.isAdvisoryTopic(info.getDestination())) {
                throw new JMSException("Cannot create a durable subscription for an advisory Topic");
            }
            SubscriptionKey key = new SubscriptionKey(context.getClientId(), info.getSubscriptionName());
            DurableTopicSubscription sub = durableSubscriptions.get(key);
           
            if (sub == null) {
               
                sub = new DurableTopicSubscription(broker, usageManager, context, info, keepDurableSubsActive);
View Full Code Here

        ack.setMessageSequenceId(messageId.getBrokerSequenceId());
        ack.setSubscritionName(subscriptionName);
        ack.setClientId(clientId);
        ack.setTransactionId(context.getTransaction()!=null?context.getTransaction().getTransactionId():null);
        final RecordLocation location=peristenceAdapter.writeCommand(ack,false);
        final SubscriptionKey key=new SubscriptionKey(clientId,subscriptionName);
        if(!context.isInTransaction()){
            if(debug)
                log.debug("Journalled acknowledge for: "+messageId+", at: "+location);
            acknowledge(messageId,location,key);
        }else{
View Full Code Here

        ack.setSubscritionName(subscriptionName);
        ack.setClientId(clientId);
        ack.setTransactionId( context.getTransaction()!=null ? context.getTransaction().getTransactionId():null);
        final RecordLocation location = peristenceAdapter.writeCommand(ack, false);
       
        final SubscriptionKey key = new SubscriptionKey(clientId, subscriptionName);       
        if( !context.isInTransaction() ) {
            if( debug )
                log.debug("Journalled acknowledge for: "+messageId+", at: "+location);
            acknowledge(messageId, location, key);
        } else {
View Full Code Here

            public void execute() throws Exception {

                // Checkpoint the acknowledged messages.
                Iterator iterator = cpAckedLastAckLocations.keySet().iterator();
                while (iterator.hasNext()) {
                    SubscriptionKey subscriptionKey = (SubscriptionKey) iterator.next();
                    MessageId identity = (MessageId) cpAckedLastAckLocations.get(subscriptionKey);
                    longTermStore.acknowledge(transactionTemplate.getContext(), subscriptionKey.clientId, subscriptionKey.subscriptionName, identity);
                }

            }
View Full Code Here

        ack.setSubscritionName(subscriptionName);
        ack.setClientId(clientId);
        ack.setTransactionId( context.getTransaction()!=null ? context.getTransaction().getTransactionId():null);
        final RecordLocation location = peristenceAdapter.writeCommand(ack, false);
       
        final SubscriptionKey key = new SubscriptionKey(clientId, subscriptionName);       
        if( !context.isInTransaction() ) {
            if( debug )
                log.debug("Journalled acknowledge for: "+messageId+", at: "+location);
            acknowledge(messageId, location, key);
        } else {
View Full Code Here

            public void execute() throws Exception {

                // Checkpoint the acknowledged messages.
                Iterator iterator = cpAckedLastAckLocations.keySet().iterator();
                while (iterator.hasNext()) {
                    SubscriptionKey subscriptionKey = (SubscriptionKey) iterator.next();
                    MessageId identity = (MessageId) cpAckedLastAckLocations.get(subscriptionKey);
                    longTermStore.acknowledge(transactionTemplate.getContext(), subscriptionKey.clientId, subscriptionKey.subscriptionName, identity);
                }

            }
View Full Code Here

        String destinationName="destinationName="
                +JMXSupport.encodeObjectNamePart(sub.getConsumerInfo().getDestination().getPhysicalName());
        String clientId="clientId="+JMXSupport.encodeObjectNamePart(context.getClientId());
        String persistentMode="persistentMode=";
        String consumerId="";
        SubscriptionKey key=new SubscriptionKey(context.getClientId(),sub.getConsumerInfo().getSubscriptionName());
        if(sub.getConsumerInfo().isDurable()){
            persistentMode+="Durable, subscriptionID="
                    +JMXSupport.encodeObjectNamePart(sub.getConsumerInfo().getSubscriptionName());
        }else{
            persistentMode+="Non-Durable";
View Full Code Here

TOP

Related Classes of org.apache.activemq.util.SubscriptionKey

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.