You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Brett Wooldridge <br...@gmail.com> on 2010/12/07 05:07:18 UTC
Bridge (NetworkConnector) Listener?
I have a dynamic network of brokers (created programmatically). And I
have a need for the "hub" broker to know about the comings and goings
of the "spoke" brokers' connections.
For example, take this topology:
Broker A <------------> Broker B
Broker A is the "hub", and initiates a bridge to Broker B (the "spoke")
via a call to BrokerService.addNetworkConnector(). This connection
may block or succeed (depending on the network and whether Broker B
is running), and it may come and go -- again depending on the network
or whether Broker B is restarted.
Through my debugger, I can see that the returned NetworkConnector
is in fact a DiscoveryNetworkConnector, and I can see that that
connector contains a private collection of Bridges, which themselves
contain Transports.
>From the JavaDoc, I can see that there is a NetworkBridgeListener
which seems to be what I want -- well, almost. It contains a callbacks
for onStart(), onStop(), and bridgeFailed() ... but none for bridgeResumed()
in the case of an underlying FailoverTransport. Will onStart() be called
after bridgeFailed() when connectivity is restored?
The bigger issue is that there in fact seems no way to get ahold of the
bridge (or bridges) inside of the DiscoveryNetworkConnector itself.
Therefore,
there is no way to actually set a listener.
Is it possible to monitor the comings and goings of a bridge? If so, how?
Thanks,
Brett
Re: Bridge (NetworkConnector) Listener?
Posted by Brett Wooldridge <br...@gmail.com>.
Gary, thanks for the answer. I'll see what I can figure out.
Brett
On Wed, Dec 8, 2010 at 10:19 PM, Gary Tully <ga...@gmail.com> wrote:
> There is no easy answer, the a new bridge is created after each
> failure, so there is no resume, just a new start.
>
> The corresponding mbeans come and go as the bridges start and
> disappear so JMX could give you a handle to active bridges and
> possibly a notification on mbean registration.
>
> Another approach would be to extend the discoveryNetworkConnector so
> that you can handle the discoveryListener events but this would
> involve registering a new discovery mechanism.
>
> What is needed is a further interface where you can register interest
> in the discoveryListener events.
>
> On 7 December 2010 04:07, Brett Wooldridge <br...@gmail.com>
> wrote:
> > I have a dynamic network of brokers (created programmatically). And I
> > have a need for the "hub" broker to know about the comings and goings
> > of the "spoke" brokers' connections.
> >
> > For example, take this topology:
> >
> > Broker A <------------> Broker B
> >
> > Broker A is the "hub", and initiates a bridge to Broker B (the "spoke")
> > via a call to BrokerService.addNetworkConnector(). This connection
> > may block or succeed (depending on the network and whether Broker B
> > is running), and it may come and go -- again depending on the network
> > or whether Broker B is restarted.
> >
> > Through my debugger, I can see that the returned NetworkConnector
> > is in fact a DiscoveryNetworkConnector, and I can see that that
> > connector contains a private collection of Bridges, which themselves
> > contain Transports.
> >
> > From the JavaDoc, I can see that there is a NetworkBridgeListener
> > which seems to be what I want -- well, almost. It contains a callbacks
> > for onStart(), onStop(), and bridgeFailed() ... but none for
> bridgeResumed()
> > in the case of an underlying FailoverTransport. Will onStart() be called
> > after bridgeFailed() when connectivity is restored?
> >
> > The bigger issue is that there in fact seems no way to get ahold of the
> > bridge (or bridges) inside of the DiscoveryNetworkConnector itself.
> > Therefore,
> > there is no way to actually set a listener.
> >
> > Is it possible to monitor the comings and goings of a bridge? If so,
> how?
> >
> > Thanks,
> > Brett
> >
>
>
>
> --
> http://blog.garytully.com
> http://fusesource.com
>
Re: Bridge (NetworkConnector) Listener?
Posted by Gary Tully <ga...@gmail.com>.
There is no easy answer, the a new bridge is created after each
failure, so there is no resume, just a new start.
The corresponding mbeans come and go as the bridges start and
disappear so JMX could give you a handle to active bridges and
possibly a notification on mbean registration.
Another approach would be to extend the discoveryNetworkConnector so
that you can handle the discoveryListener events but this would
involve registering a new discovery mechanism.
What is needed is a further interface where you can register interest
in the discoveryListener events.
On 7 December 2010 04:07, Brett Wooldridge <br...@gmail.com> wrote:
> I have a dynamic network of brokers (created programmatically). And I
> have a need for the "hub" broker to know about the comings and goings
> of the "spoke" brokers' connections.
>
> For example, take this topology:
>
> Broker A <------------> Broker B
>
> Broker A is the "hub", and initiates a bridge to Broker B (the "spoke")
> via a call to BrokerService.addNetworkConnector(). This connection
> may block or succeed (depending on the network and whether Broker B
> is running), and it may come and go -- again depending on the network
> or whether Broker B is restarted.
>
> Through my debugger, I can see that the returned NetworkConnector
> is in fact a DiscoveryNetworkConnector, and I can see that that
> connector contains a private collection of Bridges, which themselves
> contain Transports.
>
> From the JavaDoc, I can see that there is a NetworkBridgeListener
> which seems to be what I want -- well, almost. It contains a callbacks
> for onStart(), onStop(), and bridgeFailed() ... but none for bridgeResumed()
> in the case of an underlying FailoverTransport. Will onStart() be called
> after bridgeFailed() when connectivity is restored?
>
> The bigger issue is that there in fact seems no way to get ahold of the
> bridge (or bridges) inside of the DiscoveryNetworkConnector itself.
> Therefore,
> there is no way to actually set a listener.
>
> Is it possible to monitor the comings and goings of a bridge? If so, how?
>
> Thanks,
> Brett
>
--
http://blog.garytully.com
http://fusesource.com