I think the only way you are going to be able to achieve what you want is by doing what Tim mentioned....using a transaction where you commit/rollback after each message. Since processing a message could take a while, you could increase the number of consumers to increase throughput.
Take a look at the documentation here: http://activemq.apache.org/message-redelivery-and-dlq-handling.html for more info on how messages can be redelivered. On Tue, Jun 9, 2015 at 9:51 AM, spamtrap < nospam.1.friedbad...@spamgourmet.com> wrote: > On Tue, 9 Jun 2015 07:29:16 -0600, Tim Bain > <tb...@alumni.duke.edu> wrote: > > >So why can't you use transactions? Won't you get what you want if you > >commit the transaction after every successful message and > >rollback()/close() and then reconnect after every failed one? > > No. It may take some time to process a message so we operate a > 'window'. Therefore there would normally be more than one message > outstanding. > > >Also is the app server going to fail to respond to *certain* messages, or > >is it going to fail to respond to *any* messages? If the latter, you can > >delay the reconnect till you figure out that the web service is available > >again. > > We have to assume it may fail to respond to certain messages. > > >On Tue, Jun 9, 2015 at 7:09 AM, spamtrap < > >nospam.1.friedbad...@spamgourmet.com> wrote: > > > >> On Tue, 9 Jun 2015 06:43:45 -0600, Tim Bain > >> <tb...@alumni.duke.edu> wrote: > >> > >> The situation is that the consumer gets a message from a queue and > >> then converts into into a different format and sends it to an > >> application server, which should respond with an acknowledgement > >> message. If the application server does not respond to a particular > >> message then we want to be able to allow another ActiveMQ consumer to > >> pick up the message and send it elsewhere. Any consumer should be > >> able to process the message so we don't want to use selectors. > >> > >> >In this scenario, do you want to consume it twice, or do you really > want > >> to > >> >consume it once but you're picking which consumer gets it? If the > latter, > >> >can you use selectors to make sure the right consumer gets the right > >> >messages? Or maybe an embedded Camel route to send those messages to a > >> >queue that's specific to the consumer that should get them? > >> >On Jun 9, 2015 6:00 AM, "spamtrap" < > nospam.1.friedbad...@spamgourmet.com> > >> >wrote: > >> > > >> >> On Tue, 9 Jun 2015 07:24:24 -0400, Christopher Shannon > >> >> <christopher.l.shan...@gmail.com> wrote: > >> >> > >> >> >The use case you are trying to achieve is probably best done by > using a > >> >> >transaction instead of individual acknowledgements. If you call > >> rollback > >> >> >on the session then the message would be available to be > redelivered to > >> >> >another consumer. > >> >> > >> >> I don't think I can use a transaction because all messages are > >> >> committed at once. We need to be able to select which messages may > be > >> >> redelivered and which not, hence the individual acknowledge mode is > >> >> used. > >> >> > >> >> Will the rollback work with individual acknowledgements? > >> >> > >> >> > >> >> > > >> >> >On Tue, Jun 9, 2015 at 3:50 AM, spamtrap < > >> >> >nospam.1.friedbad...@spamgourmet.com> wrote: > >> >> > > >> >> >> Hi, > >> >> >> > >> >> >> In some cases we want to allow another consumer to consumer a > message > >> >> >> that has already been consumed. The session is opened using > >> >> >> INDIVIDUAL_ACKNOWLEDGE and the message has not been > acknowledged. I > >> >> >> have tried closing the session where the message has been consumed > >> but > >> >> >> the message is not available to the other consumer. How can I > >> achieve > >> >> >> what I need? > >> >> >> > >> >> >> TIA. > >> >> >> > >> >> >> > >> >> >> > >> >> > >> >> > >> >> > >> > >> > >> > > >