[cdi-dev] Standardization on a query like qualifier/annotation

Pete Muir pmuir at redhat.com
Tue Aug 23 11:00:53 EDT 2011

Hi John

The issue I see with your example solution is that it extremely un-type-safe, so doesn't fit with CDI design very well.

Can you explain the MessageSelector feature a bit more, so we can explore how to bridge this to a CDI concept?

On 15 Aug 2011, at 00:33, John D. Ament wrote:

> Hey gents (&lasses, if any exist on the list)
> I wanted to raise a question on something I'm working on for the JMS 2.0 EG.  JMS has a MessageSelector feature that allows a client to control what messages come in to the client consumer.  I'm wondering how possible it would be to standardize on a query selector type of annotation, where attributes are evaluated compared to values.  The idea would be to limit what observer methods get hit based on matches in this query selector annotation.  Here's an example:
> public void observeSomeObjects(@Observes @MessageSelector("loaded = true") MyBean mb) {
> ...
> }
> where:
> public class MyBean {
> @JmsProperty
> private boolean loaded;
> @JmsPayload
> private String data;
> //getters and setters...
> }
> so when the loaded property is true, and an event is fired, then this observer is called.  however, when false, this observer is not invoked.
> From thinking about it a bit, I was thinking that an Interceptor should do it, but wanted to get your opinions if it was something that could be standardized (potentially in CDI 1.1) rather than specific to JMS.
> Opinions?  Comments?
> Thanks,
> John
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev

More information about the cdi-dev mailing list