You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by spam trap <no...@spamgourmet.com> on 2013/02/27 11:20:08 UTC

ActiveMQ-CPP consumer starting + stopping

[ActiveMQ-CPP v3.4.4]

I have an ActiveMQ asynchronous consumer that I need to start and stop
consuming.  I also need it to redeliver messages that it has
previously consumer but not acknowledged.  To do this I am using the
INDIVIDUAL_ACKNOWLEDGE mode.

To start and stop the consumer I am using session.recover() and
session.stop() methods respectively.

Another requirement is that the consumer needs to be created in a
'stopped' state so that no messages are consumed until it is
explicitly enabled.

I have two problems:
1.  Even though I call session.stop() after creating the session for
the consumer, it does consume messages when I start the connection and
set the message listener.
2.  After calling session.stop() and session.recover() more than twice
the unacknowledged message is no longer delivered to the consumer.  I
can see it is still there. If I restart the consumer completely then
the message is delivered again.

Before I start posting code, can anyone tell me if my method is
fundamentally correct or wrong and, if wrong, suggest a better way?
Thanks.


Re: ActiveMQ-CPP consumer starting + stopping

Posted by spam trap <no...@spamgourmet.com>.
On Thu, 28 Feb 2013 10:12:13 +0000, spam trap
<no...@spamgourmet.com> wrote:

>On Wed, 27 Feb 2013 10:22:49 -0500, Timothy Bish
><ta...@gmail.com> wrote:
>
>>On 02/27/2013 05:20 AM, spam trap wrote:
>>> [ActiveMQ-CPP v3.4.4]
>>>
>>> I have an ActiveMQ asynchronous consumer that I need to start and stop
>>> consuming.  I also need it to redeliver messages that it has
>>> previously consumer but not acknowledged.  To do this I am using the
>>> INDIVIDUAL_ACKNOWLEDGE mode.
>>>
>>> To start and stop the consumer I am using session.recover() and
>>> session.stop() methods respectively.
>>>
>>> Another requirement is that the consumer needs to be created in a
>>> 'stopped' state so that no messages are consumed until it is
>>> explicitly enabled.
>>>
>>> I have two problems:
>>> 1.  Even though I call session.stop() after creating the session for
>>> the consumer, it does consume messages when I start the connection and
>>> set the message listener.
>>
>>Starting a Connection starts all sessions it created implicitly.
>
>OK.  I'll look at a different way of doing this.
>
>>> 2.  After calling session.stop() and session.recover() more than twice
>>> the unacknowledged message is no longer delivered to the consumer.  I
>>> can see it is still there. If I restart the consumer completely then
>>> the message is delivered again.
>>
>>You can add more tests to the integration tests suite to demonstrate 
>>when issue you think you are running into.
>
>I've not seen any tests.  There's only headers and libraries installed
>on our systems.  I can probably create a SSCCE though.

I guess it would be a good idea to upgrade to 3.5.0 now too?  Can I
download it with 'wget'?  I have tried and it only fetches part of the
archive (about 22K).



Re: ActiveMQ-CPP consumer starting + stopping

Posted by spam trap <no...@spamgourmet.com>.
On Wed, 27 Feb 2013 10:22:49 -0500, Timothy Bish
<ta...@gmail.com> wrote:

>On 02/27/2013 05:20 AM, spam trap wrote:
>> [ActiveMQ-CPP v3.4.4]
>>
>> I have an ActiveMQ asynchronous consumer that I need to start and stop
>> consuming.  I also need it to redeliver messages that it has
>> previously consumer but not acknowledged.  To do this I am using the
>> INDIVIDUAL_ACKNOWLEDGE mode.
>>
>> To start and stop the consumer I am using session.recover() and
>> session.stop() methods respectively.
>>
>> Another requirement is that the consumer needs to be created in a
>> 'stopped' state so that no messages are consumed until it is
>> explicitly enabled.
>>
>> I have two problems:
>> 1.  Even though I call session.stop() after creating the session for
>> the consumer, it does consume messages when I start the connection and
>> set the message listener.
>
>Starting a Connection starts all sessions it created implicitly.

OK.  I'll look at a different way of doing this.

>> 2.  After calling session.stop() and session.recover() more than twice
>> the unacknowledged message is no longer delivered to the consumer.  I
>> can see it is still there. If I restart the consumer completely then
>> the message is delivered again.
>
>You can add more tests to the integration tests suite to demonstrate 
>when issue you think you are running into.

I've not seen any tests.  There's only headers and libraries installed
on our systems.  I can probably create a SSCCE though.


Re: ActiveMQ-CPP consumer starting + stopping

Posted by Timothy Bish <ta...@gmail.com>.
On 02/27/2013 05:20 AM, spam trap wrote:
> [ActiveMQ-CPP v3.4.4]
>
> I have an ActiveMQ asynchronous consumer that I need to start and stop
> consuming.  I also need it to redeliver messages that it has
> previously consumer but not acknowledged.  To do this I am using the
> INDIVIDUAL_ACKNOWLEDGE mode.
>
> To start and stop the consumer I am using session.recover() and
> session.stop() methods respectively.
>
> Another requirement is that the consumer needs to be created in a
> 'stopped' state so that no messages are consumed until it is
> explicitly enabled.
>
> I have two problems:
> 1.  Even though I call session.stop() after creating the session for
> the consumer, it does consume messages when I start the connection and
> set the message listener.

Starting a Connection starts all sessions it created implicitly.
> 2.  After calling session.stop() and session.recover() more than twice
> the unacknowledged message is no longer delivered to the consumer.  I
> can see it is still there. If I restart the consumer completely then
> the message is delivered again.

You can add more tests to the integration tests suite to demonstrate 
when issue you think you are running into.
>
> Before I start posting code, can anyone tell me if my method is
> fundamentally correct or wrong and, if wrong, suggest a better way?
> Thanks.
>
>


-- 
Tim Bish
Sr Software Engineer | RedHat Inc.
tim.bish@redhat.com | www.fusesource.com | www.redhat.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/