[seam-dev] Feedback - JMS APIs

John D. Ament john.d.ament at gmail.com
Mon Jun 6 19:40:11 EDT 2011


The way seam JMS is working right now is based on event type.  For every
ingress route defined, there is one pair of observer method/event firing
defined by the extension.  For every egress route defined, there is one pair
of event firing/observer method defined.  In the case of a bidirectional
route, there are a total of 4 definitions created, 2 events and 2
observers.  The application developer is responsible for half of these, and
the framework the other half in all cases.  In the case of an egress route,
the application developer created an event injection point and seam jms
creates an observer method for this event.  In the case of an ingress route,
seam jms creates an event firing and the application developer creates an
observer method.  In the of a bidirectional route, since the event and
observer have the same qualifiers then both observers would be inovked by
either event firing.  However, I place special qualifiers on both; the
egress is marked @Outbound, both event and observer and likewise the ingress
is marked @Inbound for both.

On Mon, Jun 6, 2011 at 6:39 AM, Pete Muir <pmuir at redhat.com> wrote:

>
> On 5 Jun 2011, at 21:01, John D. Ament wrote:
>
> > I do agree that this binds the observer to a JMS specific event, however
> I don't believe that it is any different than how it is treated today.
>  Remember that JMS events must be uniquely qualified at both the firing and
> the observing points to avoid event feedback/infinite messaging
>
> I have to admit to (still) not really understanding this. Can you explain
> why (again, I know ;-).
>
> > (this is true of pretty much any of the bus implementations out there,
> most are proxying the object in a non child wrapper, JMS is trying to avoid
> this).  This doesn't block the application developer from creating standard
> observers for the object, but does add the need to identify the event point
> as JMS rather than the event type
> >
> > I guess this argument boils down to which makes more sense.  Should the
> event type define the event bus, or should the event injection point define
> the bus?  If we go with the former, then all strings would be forwarded to
> JMS, Errai, etc, whereas in the latter than specific strings qualified per
> event bus get to JMS, and other strings qualified for errai go to Errai.  If
> we go with the latter, we can also do this:
> > if(forwardEventToJms) {
> > eventToFire.select(JmsLiteral.INSTANCE).fire(someObject);
> > } else if(forwardToErrai) {
> > eventToFire.seelct(ErraiLiteral.INSTANCE).fire(someObject);
> > }
> >
> > Like I mentioned, I would remove the current capability, but this would
> augment it.
> >
> >
> > On Fri, Jun 3, 2011 at 9:43 AM, Pete Muir <pmuir at redhat.com> wrote:
> >
> > On 2 Jun 2011, at 16:15, John D. Ament wrote:
> >
> > > 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?
> >
> > Yes.
> >
> > However my concern with this scheme is that we are now defining that the
> observer method receives JMS events (and the event sends them) rather than
> defining a mapping between CDI events/observers and JMS.
> >
> > I think this is a step backward as increases coupling.
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/seam-dev/attachments/20110606/f30479f3/attachment.html 


More information about the seam-dev mailing list