Package org.apache.activemq.command

Examples of org.apache.activemq.command.SubscriptionInfo


        }

        public void recoverSubscription(String clientId, String subscriptionName, final MessageRecoveryListener listener)
                throws Exception {
            final String subscriptionKey = subscriptionKey(clientId, subscriptionName);
            final SubscriptionInfo info = lookupSubscription(clientId, subscriptionName);
            indexLock.writeLock().lock();
            try {
                pageFile.tx().execute(new Transaction.Closure<Exception>() {
                    public void execute(Transaction tx) throws Exception {
                        StoredDestination sd = getStoredDestination(dest, tx);
View Full Code Here


        }

        public void recoverNextMessages(String clientId, String subscriptionName, final int maxReturned,
                final MessageRecoveryListener listener) throws Exception {
            final String subscriptionKey = subscriptionKey(clientId, subscriptionName);
            final SubscriptionInfo info = lookupSubscription(clientId, subscriptionName);
            indexLock.writeLock().lock();
            try {
                pageFile.tx().execute(new Transaction.Closure<Exception>() {
                    public void execute(Transaction tx) throws Exception {
                        StoredDestination sd = getStoredDestination(dest, tx);
View Full Code Here

        }
    }

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

        return topicReferenceStore.getAllSubscriptions();
    }

    public int getMessageCount(String clientId, String subscriberName) throws IOException {
        flush();
        SubscriptionInfo info = lookupSubscription(clientId, subscriberName);
        try {
            MessageCounter counter = new MessageCounter(info, this);
            topicReferenceStore.recoverSubscription(clientId, subscriberName, counter);
            return counter.count;
        } catch (Exception 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, null);
            }
        } catch (Throwable e) {
            LOG.debug("Could not replay acknowledge for message '" + messageId
View Full Code Here

        }
        return resultList.get(0);
    }

    public SubscriptionInfo[] getAllSubscriptions() throws IOException {
        SubscriptionInfo rc[];
        EntityManager manager = adapter.beginEntityManager(null);
        try {
            ArrayList<SubscriptionInfo> l = new ArrayList<SubscriptionInfo>();

            Query query = manager.createQuery("select ss from StoredSubscription ss where ss.destination=?1");
            query.setParameter(1, destinationName);
            for (StoredSubscription ss : (List<StoredSubscription>)query.getResultList()) {
                SubscriptionInfo info = new SubscriptionInfo();
                info.setClientId(ss.getClientId());
                info.setDestination(destination);
                info.setSelector(ss.getSelector());
                info.setSubscriptionName(ss.getSubscriptionName());
                info.setSubscribedDestination(toSubscribedDestination(ss));
                l.add(info);
            }

            rc = new SubscriptionInfo[l.size()];
            l.toArray(rc);
View Full Code Here

        adapter.commitEntityManager(null, manager);
        return rc.intValue();
    }

    public SubscriptionInfo lookupSubscription(String clientId, String subscriptionName) throws IOException {
        SubscriptionInfo rc = null;
        EntityManager manager = adapter.beginEntityManager(null);
        try {
            StoredSubscription ss = findStoredSubscription(manager, clientId, subscriptionName);
            if (ss != null) {
                rc = new SubscriptionInfo();
                rc.setClientId(ss.getClientId());
                rc.setDestination(destination);
                rc.setSelector(ss.getSelector());
                rc.setSubscriptionName(ss.getSubscriptionName());
                rc.setSubscribedDestination(toSubscribedDestination(ss));
            }
        } catch (Throwable e) {
            adapter.rollbackEntityManager(null, manager);
            throw IOExceptionSupport.create(e);
        }
View Full Code Here


    public static final SubscriptionInfoTest SINGLETON = new SubscriptionInfoTest();

    public Object createObject() throws Exception {
        SubscriptionInfo info = new SubscriptionInfo();
        populateObject(info);
        return info;
    }
View Full Code Here

        return info;
    }

    protected void populateObject(Object object) throws Exception {
        super.populateObject(object);
        SubscriptionInfo info = (SubscriptionInfo) object;

        info.setClientId("ClientId:1");
        info.setDestination(createActiveMQDestination("Destination:2"));
        info.setSelector("Selector:3");
        info.setSubcriptionName("SubcriptionName:4");
    }
View Full Code Here

public class SubscriptionInfoTest extends DataFileGeneratorTestSupport {

    public static final SubscriptionInfoTest SINGLETON = new SubscriptionInfoTest();

    public Object createObject() throws Exception {
        SubscriptionInfo info = new SubscriptionInfo();
        populateObject(info);
        return info;
    }
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.