You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by steve56 <st...@csc.com> on 2009/03/16 10:08:20 UTC
how can I really use more then 1 receiver on the same queue?
my environment:
- AMQ 5.2.0
- java 1.6.0_12
the scenario:
- few threads are waiting for long-time processing messages
- each thread is using a separate connection and session
- no transaction
- session works on CLIENT_ACKNOWLEDGE mode
case 1:
- a lot of messages are present in queue
- multi-thread application starts
- only the first thread consumes messages, the other threads never.
ok, if I well understands, the default value of prefetchPolicy assign all
messages (<1000) to the first thread
case 2:
- set prefetchPolicy = 0
- now all threads work consuming sequentially (non in parallel!) messages.
i.e: a thread receives a new message only when the previous thread do
message.acknowledge (or session.commit)
If I need to process more then 1 messages in parallel with acknowledge what
can I do?
many thanks
steve56
--
View this message in context: http://www.nabble.com/how-can-I-really-use-more-then-1-receiver-on-the-same-queue--tp22534104p22534104.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: how can I really use more then 1 receiver on the same queue?
Posted by ttmgary <ga...@ttmsolutions.com>.
Seems like setting prefetchPolicy=1 (or greater, if message volume warrants
it) should activate your multiple consumer threads.
- Gary
steve56 wrote:
>
>
> case 2:
> - set prefetchPolicy = 0
> - now all threads work consuming sequentially (non in parallel!)
> messages. i.e: a thread receives a new message only when the previous
> thread do message.acknowledge (or session.commit)
>
> If I need to process more then 1 messages in parallel with acknowledge
> what can I do?
>
> many thanks
> steve56
>
>
--
View this message in context: http://www.nabble.com/how-can-I-really-use-more-then-1-receiver-on-the-same-queue--tp22534104p22586781.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: how can I really use more then 1 receiver on the same queue?
Posted by Andreas Gies <ag...@progress.com>.
Hi there,
a prefetch count of 0 would require you to poll messages from the
broker.
in your scenario it might be best to use a pre fetch count of 1.
Regards
Andreas
On Mar 20, 2009, at 4:35 PM, pclovec wrote:
>
> may be you can uses the virtualtopic function
>
>
>
> steve56 wrote:
>>
>> my environment:
>> - AMQ 5.2.0
>> - java 1.6.0_12
>>
>> the scenario:
>> - few threads are waiting for long-time processing messages
>> - each thread is using a separate connection and session
>> - no transaction
>> - session works on CLIENT_ACKNOWLEDGE mode
>>
>> case 1:
>> - a lot of messages are present in queue
>> - multi-thread application starts
>> - only the first thread consumes messages, the other threads never.
>> ok, if I well understands, the default value of prefetchPolicy
>> assign
>> all messages (<1000) to the first thread
>>
>> case 2:
>> - set prefetchPolicy = 0
>> - now all threads work consuming sequentially (non in parallel!)
>> messages. i.e: a thread receives a new message only when the previous
>> thread do message.acknowledge (or session.commit)
>>
>> If I need to process more then 1 messages in parallel with
>> acknowledge
>> what can I do?
>>
>> many thanks
>> steve56
>>
>>
>
> --
> View this message in context: http://www.nabble.com/how-can-I-really-use-more-then-1-receiver-on-the-same-queue--tp22534104p22621782.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
---
Mit freundlichen Grüssen - Kind Regards
Andreas Gies
Principal Consultant
Open Source Center of Competence
Progress Software GmbH
Agrippinawerft 26
50678 Köln
E-Mail agies@progress.com
Direct Line +49 (0)9953 980349
Mobile +49 (0)170 5759611
Skype +44 (0)20 3239 2922
Skype +353 (0)1 443 4971
Skype +1 (0)781 262 0168
http://www.progress.com
http://fusesource.com
http://open-source-adventures.blogspot.com
-------------------------------------------------------
Progress Software GmbH
Sitz der Gesellschaft: Agrippinawerft 26, 50678 Koeln;
Niederlassung: Fuerstenrieder Str. 279, 81377 Muenchen
Amtsgericht Koeln, HRB 15620;
Geschaeftsfuehrung: David Ireland
-------------------------------------------------------
Re: how can I really use more then 1 receiver on the same queue?
Posted by pclovec <pc...@gmail.com>.
may be you can uses the virtualtopic function
steve56 wrote:
>
> my environment:
> - AMQ 5.2.0
> - java 1.6.0_12
>
> the scenario:
> - few threads are waiting for long-time processing messages
> - each thread is using a separate connection and session
> - no transaction
> - session works on CLIENT_ACKNOWLEDGE mode
>
> case 1:
> - a lot of messages are present in queue
> - multi-thread application starts
> - only the first thread consumes messages, the other threads never.
> ok, if I well understands, the default value of prefetchPolicy assign
> all messages (<1000) to the first thread
>
> case 2:
> - set prefetchPolicy = 0
> - now all threads work consuming sequentially (non in parallel!)
> messages. i.e: a thread receives a new message only when the previous
> thread do message.acknowledge (or session.commit)
>
> If I need to process more then 1 messages in parallel with acknowledge
> what can I do?
>
> many thanks
> steve56
>
>
--
View this message in context: http://www.nabble.com/how-can-I-really-use-more-then-1-receiver-on-the-same-queue--tp22534104p22621782.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.