[seam-dev] Feedback - JMS APIs

Jozef Hartinger jharting at redhat.com
Thu Jun 2 09:35:18 EDT 2011


On 06/02/2011 03:29 AM, John D. Ament 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
>
>
> _______________________________________________
> seam-dev mailing list
> seam-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/seam-dev
I think that it's still a good idea to separate the routing rules from 
the event firing / observing. The need for extra code could be addressed 
by further simplification of annotation configuration e.g:

@Route(type=EGRESS, payloadType=String.class, qualifiers={}, 
destinationJndiName="jms/MyTopic", destinationType=Topic.class)

or

@Route(type=INGRESS, payloadType=Long.class, qualifiers={}, 
destinationJndiName="jms/MyQueue", destinationType=Queue.class)

In the second example, attribute names may be a bit confusing (the Queue 
is actually a source, not a destination) thus using a separate 
annotation for each routing type may be a better approach
@EgressRoute(payloadType=String.class, qualifiers={}, 
destinationJndiName="jms/MyTopic", destinationType=Topic.class)
@IngressRoute(payloadType=Long.class, qualifiers={}, 
sourceJndiName="jms/MyQueue", sourceType=Queue.class)


Each of these annotations would represent a single routing rule. These 
rules could be expressed like:
@Routes({
    @EgressRoute(...),
    @EgressRoute(...),
    @IngressRoute(...)
})

This IMHO makes it easier to define routing rules compared to the 
interface approach[1]

[1] 
http://docs.jboss.org/seam/3/jms/3.0.0.Beta2/reference/en-US/html/mapping-interfaces.html



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/seam-dev/attachments/20110602/55b2dc5f/attachment.html 


More information about the seam-dev mailing list