<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
On 06/02/2011 03:29 AM, John D. Ament wrote:
<blockquote
cite="mid:BANLkTi=9nq5tDc73h+a3ZbON4mjKH8eD9Q@mail.gmail.com"
type="cite">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:<br>
<br>
@Inject @JMS("jms/QueueOne","jms/QueueTwo","jms/QueueThree")
Event<MyType> myTypeEvent;<br>
<br>
@JMS("jms/MyTopic")<br>
public void handleMessages(@Observes Long longsInTopic) {<br>
<br>
....<br>
<br>
}<br>
<br>
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?<br>
<br>
- John<br>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
seam-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:seam-dev@lists.jboss.org">seam-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/seam-dev">https://lists.jboss.org/mailman/listinfo/seam-dev</a>
</pre>
</blockquote>
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:<br>
<br>
@Route(type=EGRESS, payloadType=String.class, qualifiers={},
destinationJndiName="jms/MyTopic", destinationType=Topic.class)<br>
<br>
or<br>
<br>
@Route(type=INGRESS, payloadType=Long.class, qualifiers={},
destinationJndiName="jms/MyQueue", destinationType=Queue.class)<br>
<br>
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<br>
@EgressRoute(payloadType=String.class, qualifiers={},
destinationJndiName="jms/MyTopic", destinationType=Topic.class)<br>
@IngressRoute(payloadType=Long.class, qualifiers={},
sourceJndiName="jms/MyQueue", sourceType=Queue.class)<br>
<br>
<br>
Each of these annotations would represent a single routing rule.
These rules could be expressed like:<br>
@Routes({<br>
@EgressRoute(...),<br>
@EgressRoute(...),<br>
@IngressRoute(...)<br>
})<br>
<br>
This IMHO makes it easier to define routing rules compared to the
interface approach[1]<br>
<br>
[1]
<a class="moz-txt-link-freetext" href="http://docs.jboss.org/seam/3/jms/3.0.0.Beta2/reference/en-US/html/mapping-interfaces.html">http://docs.jboss.org/seam/3/jms/3.0.0.Beta2/reference/en-US/html/mapping-interfaces.html</a><br>
<br>
<br>
<br>
</body>
</html>