On Wed, Jun 1, 2011 at 19:29, John D. Ament <john.d.ament@gmail.com> wrote:
Something I've been thinking about for a while now is the mapping APIs used by Seam JMS.  Currently, you write an interface to define routes used by JMS events.  This requires a bit of extra code that I'm not a big fan of.  What I was thinking was put an extra annotation on either the injection point of the event or the observer method.  The idea is that the annotation would include all of the destination configuration necessary.  For example:

@Inject @JMS("jms/QueueOne","jms/QueueTwo","jms/QueueThree") Event<MyType> myTypeEvent;

@JMS("jms/MyTopic")
public void handleMessages(@Observes Long longsInTopic) {

....

}

The issues I see, since essentially I have to create an extra observer/firing pair to support each of these, is how to determine the observed type in the event.  In general, any thoughts? Is it possible to determine the event's type in this case? If so, does the approach make sense?

- John


In Catch I added the qualifiers as optional arguments to the constructor of the event payload. Until an observer can get the meta info on the payload that's basically what you have to do. There may be a way to hack through it with an extension though.

--
Jason Porter
http://lightguard-jp.blogspot.com
http://twitter.com/lightguardjp

Software Engineer
Open Source Advocate
Author of Seam Catch - Next Generation Java Exception Handling

PGP key id: 926CCFF5
PGP key available at: keyserver.net, pgp.mit.edu