You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Anirudha Khanna <an...@yahoo-inc.com> on 2010/11/09 00:00:55 UTC

Message persistence for Topics

Hi,

I am a developer working for Yahoo! Inc. and we are currently evaluating ActiveMQ for using it as streaming solution for Yahoo serving applications. We have a requirement for the streaming platform to be able to persist messages on a topic, till the set message expiry is up, even though there isn't a durable subscriber for that Topic. Is it sufficient for the Producer to do a Producer.setDeliveryMode(DeliveryMode.PERSISTENT) to get this behaviour? When reading source I did notice this section in org.apache.activemq.broker.region.Topic.java

if (topicStore != null && message.isPersistent() && !canOptimizeOutPersistence()) {
            if (systemUsage.getStoreUsage().isFull()) {
                final String logMessage = "Usage Manager Store is Full. Stopping producer (" + message.getProducerId() + ") to prevent flooding " + getActiveMQDestination().getQualifiedName() + "."
                        + " See http://activemq.apache.org/producer-flow-control.html for more info";
                if (systemUsage.isSendFailIfNoSpace()) {
                    throw new javax.jms.ResourceAllocationException(logMessage);
                }

                waitForSpace(context, systemUsage.getStoreUsage(), logMessage);
            }
            topicStore.addMessage(context, message);
}

private boolean canOptimizeOutPersistence() {
        return durableSubcribers.size() == 0;
}



ActiveMQ version 5.3.2
JAVA version 1.6_0.22
OS - RHEL 4 Update 8

Thanks,
Anirudha

Re: Message persistence for Topics

Posted by Gary Tully <ga...@gmail.com>.
For default message persistence there needs to be a durable
subscription. For non durable subscriptions there is the retroactive
option that will allow recovery of messages based on
the recovery strategy. You can define your own strategy to capture
your exact requirement, there are a few out of the box (limited by
message count and message size) but none that monitor expiry.
see: http://activemq.apache.org/subscription-recovery-policy.html

On 8 November 2010 23:00, Anirudha Khanna <an...@yahoo-inc.com> wrote:
> Hi,
>
> I am a developer working for Yahoo! Inc. and we are currently evaluating ActiveMQ for using it as streaming solution for Yahoo serving applications. We have a requirement for the streaming platform to be able to persist messages on a topic, till the set message expiry is up, even though there isn't a durable subscriber for that Topic. Is it sufficient for the Producer to do a Producer.setDeliveryMode(DeliveryMode.PERSISTENT) to get this behaviour? When reading source I did notice this section in org.apache.activemq.broker.region.Topic.java
>
> if (topicStore != null && message.isPersistent() && !canOptimizeOutPersistence()) {
>            if (systemUsage.getStoreUsage().isFull()) {
>                final String logMessage = "Usage Manager Store is Full. Stopping producer (" + message.getProducerId() + ") to prevent flooding " + getActiveMQDestination().getQualifiedName() + "."
>                        + " See http://activemq.apache.org/producer-flow-control.html for more info";
>                if (systemUsage.isSendFailIfNoSpace()) {
>                    throw new javax.jms.ResourceAllocationException(logMessage);
>                }
>
>                waitForSpace(context, systemUsage.getStoreUsage(), logMessage);
>            }
>            topicStore.addMessage(context, message);
> }
>
> private boolean canOptimizeOutPersistence() {
>        return durableSubcribers.size() == 0;
> }
>
>
>
> ActiveMQ version 5.3.2
> JAVA version 1.6_0.22
> OS - RHEL 4 Update 8
>
> Thanks,
> Anirudha
>



-- 
http://blog.garytully.com
http://fusesource.com