activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hiram Chirino" <hi...@hiramchirino.com>
Subject Re: communicating with Topic subscribers from custom interceptor class
Date Mon, 27 Nov 2006 20:55:09 GMT
On 11/27/06, J. Patrick Bedell <jpbedell@gmail.com> wrote:
> Hello,
>
> On 11/27/06, James Strachan <james.strachan@gmail.com> wrote:
> > On 11/27/06, J. Patrick Bedell <jpbedell@gmail.com> wrote:
> >
> > >    I'm writing a custom interceptor that extends BrokerFilter in order
> > > to process messages that are published to particular Topics.  My
> > > question is, how can my interceptor make a direct connection with the
> > > JMS client that published the message?
> >
> > What kind of thing are you trying to do?
> >
>
>    The custom interceptor creates a marketplace, and clients send
> digital financial instruments.  The interceptor must keep track of the
> originator of the messages that include these assets, because the
> client must be able to retrieve its asset from the interceptor when it
> chooses.  Also, the interceptor must be able to initiate messages to a
> client when a trade has been executed, to inform them of the execution
> of a trade and to deliver the result.
>
>    What I would really like to do is have some way of, from the
> interceptor, initiate communication with a subscriber that has
> previously sent a message that is published to a Topic that is
> processed by the interceptor.
>
> >
> > > Does the subscriber have to
> > > manually set an identifier in order to be accessible, or are the
> > > identifiers automatically generated?
> >
> > Subscribers are visible in JMX or the BrokerService via their unique
> > generated consumerId's.
> >
>
>    Should I just expect the clients to subscribe to a per-client queue
> so that there is a per-client control channel, so that the market
> server (i.e., the interceptor class) can communicate with the client?
>

That would work but if your interceptor keep track of the client
subscriptions, then it could send a message that is specifically
targeted for that subscription.  The AdvisoryBroker implementation
makes use of it.  See the use of the setTargetConsumerId() method in
the AdvisoryBroker class.

>
> >
> > >    Additionally, is there a way to access the list of subscribers to a
> > > particular topic and send messages to individual subscribers from a
> > > custom interceptor class?
> >
> > Not easily. What are you trying to do - maybe there's an easier way.
> >
>
>    Thanks again!
>
>    Patrick
>
> >
> > James
> > -------
> > http://radio.weblogs.com/0112098/
> >
>
>
> --
>    J. Patrick Bedell
>    jpbedell@gmail.com
>    http://infoeng.sourceforge.net
>    http://rothbardix.blogspot.com
>


-- 
Regards,
Hiram

Blog: http://hiramchirino.com

Mime
View raw message