[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xmlblaster-devel] Get connection states of connected nodes...


Thanks for the info, that sounds like the way to do it, but it may be more
than I really need right now. Given that I have a list of the node ids, can
I make a simple query to see if they are connected to my local xmlBlaster
instance? I can query my local node for the nodeList using:

MsgUnit[] msgs = con.get(
                            "<key oid='__cmd:/node/?nodeList'/>",

and that gives me the nodeList, but when I attempt to get any information
about any of those nodes, I get an error:

errorCode=user.illegalArgument message=#1.1.1 Query of foreign cluster node
'vsp' is not implemented, sorry '/node/vsp/?numTopics' rejected

I can, however, query my local node for the same information and I get it:

<key oid='__cmd:/node/stauntonstc/?numTopics'/>' =  <qos> <isGet/> </qos>
<key oid='__cmd:/node/stauntonstc/?numTopics'/> <content

I really just need a simple method to make sure that my local cluster node
is in contact with the others.


----- Original Message ----- 
From: "Marcel Ruff" <mr at marcelruff.info>
To: <xmlblaster-devel at server.xmlBlaster.org>
Sent: Wednesday, March 08, 2006 7:56 PM
Subject: Re: [xmlblaster-devel] Get connection states of connected nodes...

> Matthew Sargent wrote:
> > Hi,
> >
> > We are using the simple domain to master mapping and have setup
> > several mater/slave relationships. I would like to test if the
> > xmlBlaster instance I am connected to is further connected to others
> > in the cluster. I have a list of domains that I am making
> > subscriptions to and would like to use those to figure out if the
> > masters associated with each particular domain is connected. I see
> > many examples if you already have the master node id, but is there a
> > way to get the master node id for a domain so I can use that to query
> > the connection state?
> Hmm, probably not out of the box ...
> What you can certainly to is to register a native plugin in
> xmlBlasterPlugins.xml,
> you can take a copy of org.xmlBlaster.engine.EventPlugin.java as a base
> and throw
> out everything you don't need.
> Find the code line where
>   this.engineGlob = ...
> is assigned.
> With this you can call
>    ClusterNode[] nodes =
> this.engineGlob.getClusterManager().getClusterNodes();
>    for (int i=0; i<nodes.length; i++) {
>       ClusterNode node = nodes[i];
>       node.getConnectionState();  // See javadoc, marks alive, polling
>       node.getId();               // the nodes name
> Now you know the cluster nodes and if the connection is alive.
> On the other side note that the EventPlugin implements
> I_SubscriptionListener.
> With this listener you get notifed about all coming and going
>   public void subscriptionAdd(SubscriptionEvent subscriptionEvent) {
>       SubscriptionInfo subscriptionInfo =
> subscriptionEvent.getSubscriptionInfo();
>       String domain = subscriptionInfo.getKeyData().getDomain();
>       ...
>   }
>   public void subscriptionRemove(SubscriptionEvent subscriptionEvent) {
>     ...
>   }
> Now you know about all subscribed domains.
> You could now publish a PtP message to the clients interested or better
> publish the current list
> to a topic (say oid="myCurrentDomainList") where your clients retrieve
> it from with get().
> regards
> Marcel
> >
> > I would like to use the con.get() to gather this information
> > periodically so I can report on connection status.
> >
> > Thanks,
> >
> > Matt