Hi Ken, On 15 November 2011 19:43, Ken Giusti <[email protected]> wrote:
> Hi folks, > > I'm working on adding support for server-side message selectors to the C++ > Broker. > > See https://issues.apache.org/jira/browse/QPID-530 (better late than > never...) > > Excellent... not having to implement selectors on the client side will be a real win! > It would be preferable to have the C++ broker's use model for message > selectors be consistent with the Java Broker's implementation - and I > believe the Java Broker already implements Message Selectors (correct?) > > The Java Broker does indeed implement message selectors > I was planning on implementing the feature's behavior so it will be > compliant with the description of Message Selections as per the JMS 1.1 > spec. Is this the model for message selectors that is supported by the > Java Broker? If not, is there documentation available that describes its > implementation? > > I'm not sure if there is any documentation on message selectors and their implementation. One thing to be aware of is that selectors probably need to be implemented both on the queue consumers and (because of the way that AMQP models topics) on the bindings between exchanges and queues. The bindings model is easier since you are just implementing an additional filter on which messages are routed to a given queue through the exchange, and the JMS Selector is simply another filter to evaluate in conjunction with the other tests associated with a given binding. For the queue consumer implementation, this basically depends on the queue implementation. The way that the Java Broker works internally, each consumer keeps a pointer into the queue, the pointer is advanced when the consumer has capacity to receive a message, and the message at the pointer is evaluated against the criteria of the consumer (e.g. the message selector, whether the consumer is "no-local" or not). IIRC the selector is passed to the consumer as an argument called "x-filter-jms-selector" where the value is a selector in the defined JMS selector syntax (the same name is used to pass the selector when binding a queue to an exchange for topic style selectors). Also note that I believe there has recently been some work done to identify on connection whether a broker supports selectors or not, so that the Java client can determine whether it needs to use the client-side selectors or can utilise the server side selectors ( https://issues.apache.org/jira/browse/QPID-3518) - if you implement selectors in the C++ broker you should advertise this through the connection properties in the same way. Cheers, Rob
