Package org.apache.activemq.util

Examples of org.apache.activemq.util.SubscriptionKey


            }
        }
        DurableSubscriptionView view=(DurableSubscriptionView) durableTopicSubscribers.remove(key);
        if(view!=null){
            // need to put this back in the inactive list
            SubscriptionKey subscriptionKey=new SubscriptionKey(view.getClientId(),view.getSubscriptionName());
            SubscriptionInfo info=new SubscriptionInfo();
            info.setClientId(subscriptionKey.getClientId());
            info.setSubcriptionName(subscriptionKey.getSubscriptionName());
            info.setDestination(new ActiveMQTopic(view.getDestinationName()));
            addInactiveSubscription(subscriptionKey,info);
        }
    }
View Full Code Here


                    SubscriptionInfo[] infos= destinationFactory.getAllDurableSubscriptions((ActiveMQTopic) dest);
                    if(infos!=null){
                        for(int i=0;i<infos.length;i++){
                            SubscriptionInfo info=infos[i];
                            log.debug("Restoring durable subscription: "+infos);
                            SubscriptionKey key=new SubscriptionKey(info);
                            subscriptions.put(key,info);
                        }
                    }
                }
            }
        }
        for(Iterator i=subscriptions.entrySet().iterator();i.hasNext();){
            Map.Entry entry=(Entry) i.next();
            SubscriptionKey key=(SubscriptionKey) entry.getKey();
            SubscriptionInfo info=(SubscriptionInfo) entry.getValue();
            addInactiveSubscription(key,info);
        }
    }
View Full Code Here

        super.addMessage(context, message);
        lastMessageId = message.getMessageId();
    }

    public void acknowledge(ConnectionContext context, String clientId, String subscriptionName, MessageId messageId) throws IOException {
        ackDatabase.put(new SubscriptionKey(clientId, subscriptionName), messageId);
    }
View Full Code Here

    public void acknowledge(ConnectionContext context, String clientId, String subscriptionName, MessageId messageId) throws IOException {
        ackDatabase.put(new SubscriptionKey(clientId, subscriptionName), messageId);
    }

    public SubscriptionInfo lookupSubscription(String clientId, String subscriptionName) throws IOException {
        return (SubscriptionInfo) subscriberDatabase.get(new SubscriptionKey(clientId, subscriptionName));
    }
View Full Code Here

        SubscriptionInfo info = new SubscriptionInfo();
        info.setDestination(destination);
        info.setClientId(clientId);
        info.setSelector(selector);
        info.setSubcriptionName(subscriptionName);
        SubscriptionKey key = new SubscriptionKey(clientId, subscriptionName);
        subscriberDatabase.put(key, info);
        MessageId l=retroactive ? null : lastMessageId;
        if( l!=null ) {
            ackDatabase.put(key, l);
        }
View Full Code Here

            ackDatabase.put(key, l);
        }
    }
   
    public void deleteSubscription(String clientId, String subscriptionName) {
        org.apache.activemq.util.SubscriptionKey key = new SubscriptionKey(clientId, subscriptionName);
        ackDatabase.remove(key);
        subscriberDatabase.remove(key);
    }
View Full Code Here

        subscriberDatabase.remove(key);
    }
   
    public void recoverSubscription(String clientId,String subscriptionName,MessageRecoveryListener listener)
                    throws Exception{
        MessageId lastAck=(MessageId) ackDatabase.get(new SubscriptionKey(clientId,subscriptionName));
        boolean pastLastAck=lastAck==null;
        // the message table is a synchronizedMap - so just have to synchronize here
        synchronized(messageTable){
            for(Iterator iter=messageTable.entrySet().iterator();iter.hasNext();){
                Map.Entry entry=(Entry) iter.next();
View Full Code Here

            listener.finished();
        }
    }
   
    public void recoverNextMessages(String clientId,String subscriptionName,MessageId lastMessageId,int maxReturned,MessageRecoveryListener listener) throws Exception{
        MessageId lastAck=(MessageId) ackDatabase.get(new SubscriptionKey(clientId,subscriptionName));
        boolean startFound=false;
        // the message table is a synchronizedMap - so just have to synchronize here
        synchronized(messageTable){
            int count = 0;
            for(Iterator iter=messageTable.entrySet().iterator();iter.hasNext() && count < maxReturned;){
View Full Code Here

        }
        return null;
    }
    public int getMessageCount(String clientId,String subscriberName) throws IOException{
        int result = 0;
        MessageId lastAck=(MessageId) ackDatabase.get(new SubscriptionKey(clientId,subscriberName));
        // the message table is a synchronizedMap - so just have to synchronize here
        synchronized(messageTable){
            result = messageTable.size();
            for(Iterator iter=messageTable.entrySet().iterator();iter.hasNext();){
                Map.Entry entry=(Entry) iter.next();
View Full Code Here

    public ObjectName registerSubscription(ConnectionContext context, Subscription sub) {
        String connectionClientId = context.getClientId();
        ObjectName brokerJmxObjectName = brokerObjectName;
        String objectNameStr = getSubscriptionObjectName(sub, connectionClientId, brokerJmxObjectName);

        SubscriptionKey key = new SubscriptionKey(context.getClientId(), sub.getConsumerInfo().getSubscriptionName());
        try {
            ObjectName objectName = new ObjectName(objectNameStr);
            SubscriptionView view;
            if (sub.getConsumerInfo().isDurable()) {
                view = new DurableSubscriptionView(this, context.getClientId(), sub);
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.