[seam-dev] Feedback - JMS APIs

John D. Ament john.d.ament at gmail.com
Thu Jun 2 11:15:14 EDT 2011


Certainly, would have made more sense.

Currently, in JMS you define interfaces like this to map routes - equivalent
to a CDI Event Bridge - to JMS Destinations (Queues and Topics):

public interfaces MyMappingInterface{
@Inbound
public void handleStrings(@Observes String s, @JmsDestination("jms/MyTopic")
Topic topic);
@Outbound
public void handleLongs(@Observes Long l, @JmsDestination("jms/MyQueue")
Queue queue);
}

This says that a listener will be created for the topic jms/MyTopic and any
TextMessage or ObjectMessage with payload type String.class will be
forwarded to an observer method defined like this:

public void observeStrings(@Observes @Inbound String s) {

}

Likewise, the second line in the interface says that Events of type Long
that are fired with the @Outbound qualifier will be sent to a Queue
jms/MyQueue,

@Inject @Outbound Event<Long> longEvent;

Results in Seam JMS dynamically generating an observer method on deployment
that handles and forwards the long fired.

What I'm proposing is that we do away with (not literally, I would keep it
in) the interface.  Instead, we look at the events injected and the
observers defined.  The same observer method would be defined like this:

@JMS("jms/MyTopic")
public void observeStrings(@Observes @Inbound String s) {
}

And the injected event:

@Inject @JMS("jms/MyQueue") @Outbound Event<Long> longEvent;

Does that make sense?

John


On Thu, Jun 2, 2011 at 7:49 AM, Pete Muir <pmuir at redhat.com> wrote:

>
> On 2 Jun 2011, at 02:29, 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?
>
> Can you show what this replaces? I.e. before and after?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/seam-dev/attachments/20110602/08f1f929/attachment.html 


More information about the seam-dev mailing list