activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jake Choi ...@yahoo-inc.com>
Subject Re: How to configure this combination of queue cursors?
Date Thu, 01 Aug 2013 22:22:05 GMT
FYI, the following hacky way just works for me, although it looks pretty..
buggy.  I just checked all invocation references to
BrokerService#isPersistent and kind of confirmed that, there's no case it is
referenced by other thread at the same time.

But definitely, hope the better way exists.

<pre>
        PolicyEntry policyEntry = new PolicyEntry();
        policyEntry..setPendingDurableSubscriberPolicy(new
StorePendingDurableSubscriberMessageStoragePolicy() {
            @Override
            public PendingMessageCursor
getSubscriberPendingMessageCursor(Broker broker, String clientId, String
name,
                    int maxBatchSize, DurableTopicSubscription sub) {
                boolean persistent =
broker.getBrokerService().isPersistent();
                broker.getBrokerService().setPersistent(false);
                StoreDurableSubscriberCursor cursor =
(StoreDurableSubscriberCursor) super
                        .getSubscriberPendingMessageCursor(broker, clientId,
name, maxBatchSize, sub);
                broker.getBrokerService().setPersistent(persistent);
                return cursor;
            }
        });
</pre>


Jake Choi wrote
> Now, I want to do the same for the durable topic subscription but looks
> not possible at this time, unlike the queue case: 
> 
>         PolicyEntry policyEntry = new PolicyEntry();
>         policyEntry.setPendingDurableSubscriberPolicy(new
> StorePendingDurableSubscriberMessageStoragePolicy() {
>             @Override
>             public PendingMessageCursor
> getSubscriberPendingMessageCursor(Broker broker, String clientId, String
> name,
>                     int maxBatchSize, DurableTopicSubscription sub) {
>                 StoreDurableSubscriberCursor cursor =
> (StoreDurableSubscriberCursor) super
>                         .getSubscriberPendingMessageCursor(broker,
> clientId, name, maxBatchSize, sub);
>                 // there's no #setNonPersistent(PendingMessageCursor
> cursor);
>                 // so, how to replace "nonPersistent" from
> FilePendingMessageCursor to VM- here?
>                 return cursor;
>             }
>         });
> 
> Any other way?





--
View this message in context: http://activemq.2283324.n4.nabble.com/How-to-configure-this-combination-of-queue-cursors-tp4670003p4670027.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message