Package org.apache.activemq.command

Examples of org.apache.activemq.command.SubscriptionInfo


                pageFile.tx().execute(new Transaction.Closure<IOException>(){
                    public void execute(Transaction tx) throws IOException {
                        StoredDestination sd = getStoredDestination(dest, tx);
                        for (Iterator<Entry<String, KahaSubscriptionCommand>> iterator = sd.subscriptions.iterator(tx); iterator.hasNext();) {
                            Entry<String, KahaSubscriptionCommand> entry = iterator.next();
                            SubscriptionInfo info = (SubscriptionInfo)wireFormat.unmarshal( new DataInputStream(entry.getValue().getSubscriptionInfo().newInput()) );
                            subscriptions.add(info);

                        }
                    }
                });
View Full Code Here


        // Eagerly recover the durable subscriptions
        if (store != null) {
            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.
View Full Code Here

        return (SubscriptionInfo)subscriberContainer.get(getSubscriptionKey(clientId,subscriptionName));
    }

    public void addSubsciption(String clientId,String subscriptionName,String selector,boolean retroactive)
            throws IOException{
        SubscriptionInfo info=new SubscriptionInfo();
        info.setDestination(destination);
        info.setClientId(clientId);
        info.setSelector(selector);
        info.setSubcriptionName(subscriptionName);
        String key=getSubscriptionKey(clientId,subscriptionName);
        // if already exists - won't add it again as it causes data files
        // to hang around
        if(!subscriberContainer.containsKey(key)){
            subscriberContainer.put(key,info);
View Full Code Here

       
    }
   
    public void replayAcknowledge(ConnectionContext context, String clientId, String subscritionName, MessageId messageId) {
        try {
            SubscriptionInfo sub = longTermStore.lookupSubscription(clientId, subscritionName);
            if( sub != null ) {
                longTermStore.acknowledge(context, clientId, subscritionName, messageId);
            }
        }
        catch (Throwable e) {
View Full Code Here

       
    }
   
    public void replayAcknowledge(ConnectionContext context, String clientId, String subscritionName, MessageId messageId) {
        try {
            SubscriptionInfo sub = longTermStore.lookupSubscription(clientId, subscritionName);
            if( sub != null ) {
                longTermStore.acknowledge(context, clientId, subscritionName, messageId);
            }
        }
        catch (Throwable e) {
View Full Code Here

        return (SubscriptionInfo)subscriberContainer.get(getSubscriptionKey(clientId,subscriptionName));
    }

    public synchronized void addSubsciption(String clientId,String subscriptionName,String selector,boolean retroactive)
            throws IOException{
        SubscriptionInfo info=new SubscriptionInfo();
        info.setDestination(destination);
        info.setClientId(clientId);
        info.setSelector(selector);
        info.setSubcriptionName(subscriptionName);
        String key=getSubscriptionKey(clientId,subscriptionName);
        // if already exists - won't add it again as it causes data files
        // to hang around
        if(!subscriberContainer.containsKey(key)){
            subscriberContainer.put(key,info);
View Full Code Here

        }
        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

                ActiveMQDestination dest=(ActiveMQDestination) iter.next();
                if(dest.isTopic()){
                    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

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

    public void addSubsciption(String clientId, String subscriptionName, String selector, boolean retroactive) throws IOException {
        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

            s.setString(3,subscriptionName);
            rs=s.executeQuery();
            if(!rs.next()){
                return null;
            }
            SubscriptionInfo subscription=new SubscriptionInfo();
            subscription.setDestination(destination);
            subscription.setClientId(clientId);
            subscription.setSubcriptionName(subscriptionName);
            subscription.setSelector(rs.getString(1));
            return subscription;
        }finally{
            close(rs);
            close(s);
        }
View Full Code Here

TOP

Related Classes of org.apache.activemq.command.SubscriptionInfo

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.