Using selectors, I believe, will only cause the message to not be consumed by anyone, not put back on the queue. If this is really necessary (and Id like to see a use case), then the i'd try an idimpotent consumer and putting the message back on the queue yourself in an otherwise clause.
Of course, most of the time people are trying to do this it means that the design is wrong. If there are multiple consumers of different types of messages on one queue, its best to create a route that sorts the messages to destinations so as to create a typed channel that has their own consumers. In the case where something is truly broadcast then I would route the messages to a topic where the consumers can make thier own decisions about the messages without affecting others. The question is what is your use case for doing this Jack? *Robert Simmons Jr. MSc. - Lead Java Architect @ EA* *Author of: Hardcore Java (2003) and Maintainable Java (2012)* *LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39 <http://www.linkedin.com/pub/robert-simmons/40/852/a39>* On Tue, Apr 29, 2014 at 1:41 AM, Claus Ibsen <[email protected]> wrote: > Hi > > You can use jms message selectors to filter only wanted messages. > You set these on the jms endpoint. > > On Mon, Apr 28, 2014 at 7:42 PM, Jack <[email protected]> wrote: > > Hi, > > > > I¹m looking for a way to divert messages to an alternative queue based > on an > > expression. > > I was hoping to use the choice mechanism for this. Something like: > > > > <choice> > > <when> > > <simple>'10' > ${in.body}</simple> > > <to uri=³activemq:move.somewhere.else" /> > > </when> > > </choice> > > > > The problem with this approach is that all the messages that aren¹t > matched > > by the condition will get dropped. > > > > Does anyone know a way I can filter off messages and leave the remaining > > messages on the queue to be consumed by something else? > > I¹ve scoured the docs but can¹t find anything that I can see will work. > > > > Thanks for any help in advance! > > > > - Jack > > > > > > > > > > -- > Claus Ibsen > ----------------- > Red Hat, Inc. > Email: [email protected] > Twitter: davsclaus > Blog: http://davsclaus.com > Author of Camel in Action: http://www.manning.com/ibsen > hawtio: http://hawt.io/ > fabric8: http://fabric8.io/ >
