You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by javierco <vj...@gmail.com> on 2012/12/10 19:56:18 UTC

Producer to Topic with Consumer down, the broker is waiting?

Hello, we have a Topic with one durable subscriber consumer and one producer.
If both are running, the messages flow with no issues. However, if the
consumer is down, when the producer sends a message, it waits for the broker
to acknowledge without ever coming back.

Is there a configuration property or any other setting we can tune to avoid
this behavior? Basically we want the producer to send and forget, and have
the broker keep the messages in the topic until the durable subscriber comes
back alive. (Or, do they both need to be running all the time?)

We are using ActiveMQ 5.6 with Spring 3.1.1 on Apache Tomcat 7.0.27.

Thanks for the support!

Javier C.




--
View this message in context: http://activemq.2283324.n4.nabble.com/Producer-to-Topic-with-Consumer-down-the-broker-is-waiting-tp4660452.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Producer to Topic with Consumer down, the broker is waiting?

Posted by javierco <vj...@gmail.com>.
Here it is:
- running ActiveMQ 5.6.0 standalone on its own JVM and using the default
configuration, so I guess no need to post those files? (let me know
otherwise)
- running both producer and consumer on separate instances of Apache Tomcat
7.0.27
- app is using Spring Framework 3.1.1

- this is the bean config for the Producer:
        
        <bean id="jmsConnectionFactory"
class="org.apache.activemq.pool.PooledConnectionFactory"
            destroy-method="stop">
            <property name="connectionFactory">
                <bean class="org.apache.activemq.ActiveMQConnectionFactory">
                    <property name="brokerURL"
value="tcp://127.0.0.1:61616"/>
                </bean>
            </property>
        </bean>
        
        <bean id="destination"
class="org.apache.activemq.command.ActiveMQTopic">
            <constructor-arg value="broadcastTopic" />
        </bean>
        
        <bean id="jmsTemplate"
class="org.springframework.jms.core.JmsTemplate">
            <property name="connectionFactory" ref="jmsConnectionFactory" />
            <property name="defaultDestination" ref="destination" />
        </bean>
        
        <bean id="producer" class="JmsMessageProducer">
            <property name="template" ref="jmsTemplate" />
        </bean>

- this is the bean config for the Consumer
        
        <bean id="jmsConnectionFactory"
class="org.apache.activemq.pool.PooledConnectionFactory"
              destroy-method="stop">
            <property name="connectionFactory">
                <bean class="org.apache.activemq.ActiveMQConnectionFactory">
                    <property name="brokerURL"
value="tcp://127.0.0.1:61616"/>
                </bean>
            </property>
        </bean>
        
        <bean id="topicDestination"
class="org.apache.activemq.command.ActiveMQTopic">
            <constructor-arg value="broadcastTopic" />
        </bean>
        
        <bean id="consumer" class="JmsDataExchanger" />
        
        <bean id="messageListener"
class="org.springframework.jms.listener.SimpleMessageListenerContainer">
            <property name="connectionFactory" ref="jmsConnectionFactory" />
            <property name="destination" ref="topicDestination" />
            <property name="messageListener" ref="consumer" />
            <property name="subscriptionDurable" value="true" />
            <property name="clientId" value="myClient" />
            <property name="durableSubscriptionName" value="myClient" />
        </bean>

If this is not enough please let me know, I will try to recreate this issue
in a small test case in the meantime. Thanks!



--
View this message in context: http://activemq.2283324.n4.nabble.com/Producer-to-Topic-with-Consumer-down-the-broker-is-waiting-tp4660452p4660462.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Producer to Topic with Consumer down, the broker is waiting?

Posted by Christian Posta <ch...@gmail.com>.
No, this is not the correct behavior. It should not matter if the consumer
is there or not.
Can you reproduce this? Or can you post your configs?


On Mon, Dec 10, 2012 at 12:34 PM, javierco <vj...@gmail.com> wrote:

> Hi Christian, thanks for the quick response!
>
> I do want the broker to always send the message "hey i got your message and
> it's safely stored", but even when the consumer of that message is down.
>
> The problem I'm having is that it looks like the broker wants to respond
> "hey i got your message, but I'm waiting for the consumer to come back
> alive
> before I reply to you" and the producer get's blocked. Is this the right
> behavior? Do I need to have the Consumer running always in order to have
> sync message delivery?
>
> Javier C.
>
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Producer-to-Topic-with-Consumer-down-the-broker-is-waiting-tp4660452p4660459.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta

Re: Producer to Topic with Consumer down, the broker is waiting?

Posted by javierco <vj...@gmail.com>.
Hi Christian, thanks for the quick response!

I do want the broker to always send the message "hey i got your message and
it's safely stored", but even when the consumer of that message is down.

The problem I'm having is that it looks like the broker wants to respond
"hey i got your message, but I'm waiting for the consumer to come back alive
before I reply to you" and the producer get's blocked. Is this the right
behavior? Do I need to have the Consumer running always in order to have
sync message delivery?

Javier C.




--
View this message in context: http://activemq.2283324.n4.nabble.com/Producer-to-Topic-with-Consumer-down-the-broker-is-waiting-tp4660452p4660459.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Producer to Topic with Consumer down, the broker is waiting?

Posted by Christian Posta <ch...@gmail.com>.
With persistent messages, you expect the broker to respond saying "hey i
got your message and it's safely stored"

You can force the connection to always send async with:
ActiveMQConnection.setUseAsyncSend

However, if you forgo the sync request/response with the broker on
persistent messages, if a message gets lost you may not know.



On Mon, Dec 10, 2012 at 11:56 AM, javierco <vj...@gmail.com> wrote:

> Hello, we have a Topic with one durable subscriber consumer and one
> producer.
> If both are running, the messages flow with no issues. However, if the
> consumer is down, when the producer sends a message, it waits for the
> broker
> to acknowledge without ever coming back.
>
> Is there a configuration property or any other setting we can tune to avoid
> this behavior? Basically we want the producer to send and forget, and have
> the broker keep the messages in the topic until the durable subscriber
> comes
> back alive. (Or, do they both need to be running all the time?)
>
> We are using ActiveMQ 5.6 with Spring 3.1.1 on Apache Tomcat 7.0.27.
>
> Thanks for the support!
>
> Javier C.
>
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Producer-to-Topic-with-Consumer-down-the-broker-is-waiting-tp4660452.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta