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

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



Salute,

in the current SVN there it is now possible to invoke JMX commands from the server command line:

java -Dcom.sun.management.jmxremote org.xmlBlaster.Main
..
j <JMX call> For example 'j org.xmlBlaster:nodeClass=node,node="heron"/action=getFreeMemStr'


if you wish you can play interactively with this feature.
If the JMX possibilities are enough for you, we could add this
to be available with command messages (over your SSL connection) as well.

Your query is something like:

j org.xmlBlaster:nodeClass=node,node="frodo",clientClass=client,client="sam",sessionClass=session,session="1"/action=getConnectionState

and returned is "ALIVE" or "POLLING" depending on sam's availability,

Marcel

Matthew Sargent wrote:
Marcel,

----- Original Message ----- From: "Marcel Ruff" <mr at marcelruff.info>
To: <xmlblaster-devel at server.xmlBlaster.org>
Sent: Sunday, March 12, 2006 9:48 AM
Subject: Re: [xmlblaster-devel] Get connection states of connected nodes...



Matthew Sargent wrote:
I can see lots of info about the admin messages and such, but is it
possible for me to access these from my connected client programattically? I
would like to report to the user of my client the status of the remote node.
My client connects to the local xmlBlaster via an SSL connection, the telnet
port to the remote machine is not open. The only connection between my local
xmlBlaster and the remote one is via the SSL as well (for security purposes)
Hmm, i'm not sure i understand you here.
The "__cmd:" messages can't currently access everything what JMX can (as
seen in jconsole).
Probably adding a "__jmx:" prefix to do a JMX query over a
xmlBlaster-message could resolve
this.

That indeed might work, essentially, I am trying to report to the user of my client application if the node containing the messages they seek to receive is still up and running.

Say I have a two nodes, one named frodo and one named sam. Frodo and sam are
connected in a cluster where sam is the master of a domain named 'garden'.
My client connects to frodo and want to receive 'garden' messages. The
client is happily running and receiving garden messages. Then the messages
stop. Is it because there are none beign sent anymore or is it because frodo
is no longer connected to sam? I want my client to be able to go out and
periodically check if frodo is connected to sam. In the future, I would like
to be able to test if in my cluster, is the master of 'garden' reachable?
Right now, though knowing that frodo is connected to sam would be enough.

I can see that using JMX i can go out and look and see, but I would like my
client to be able to report it and be able to use the SSL connections I have
already setup and made secure...

Thanks again!

Is it this you  are after?

regards
Marcel
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


Yes, the forwarding of a __cmd to the remote cluster node to find out
its attributes (like topic names) is not implemented.



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
type='String'>3</content>

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


See my first remark above, isn't this enough then?

Marcel

Matt


----- 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


subscriptions:


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