Hi folks,

a SocketGetter is now available in the contrib package.
It is in the latest release in the repository which can be accessed with
svn.

This little client allows read only access to xmlBlaster messages with a
simple telnet from within a script for example to read the content of
messages which are stored in the mom.

The usage for the getter is:
  java org.xmlBlaster.contrib.socketgetter.SocketGetter -port <port>

  Whereat port denotes the port which has to be used locally to
  connect to the client.

Example for a simple test:
 - start the xmlBlaster on your server in a console:
   java org.xmlBlaster.Main -bootstrapHostname localhost

 - start the SocketGetter client and connect it to your xmlBlaster in
   another console:
   java org.xmlBlaster.contrib.socketgetter.SocketGetter -port 9876 \
   -plugin/socket/hostname localhost

   Now we have a client running and serving a simple getter
   functionality on port 9876.

 - Access this client and read some content:
   (sleep 1; echo "get __sys__UserList"; sleep 1) \
   | telnet localhost 9876

 - now we should get something like:

 <qos>

<sender>/node/xmlBlaster_192_168_10_227_3412/client/__RequestBroker_internal[xmlBlaster_192_168_10_227_3412]/1</sender>
  <expiration lifeTime='-1'/>
  <rcvTimestamp nanos='1141914651563000001'/>
  <forceUpdate/>
  <isPublish/>
 </qos>

 <key oid='__sys__UserList'>
  <__sys__internal></__sys__internal>
 </key>
 <content
type='String'>__sys__jdbc,__RequestBroker_internal[xmlBlaster_192_168_10_227_3412],xmlblaster</content>

  The telnet session has been closed by theSocketGetter and the content
  may be used in any imaginable way now.


Ok, this is the possibility to connect simple, easy and fast to any
server running locally or remote. But we can also establich this little
client in a native plugin, so that it starts up with the server and
runns therefore in the same JVM. We do not need to control its existent
extra.

For the plugin, we add our xmlBlasterPlugins.properties and add the
configuration for our plugin:

   <plugin id='SocketGetter'
className='org.xmlBlaster.contrib.socketgetter.SocketGetterPlugin'>
      <action do='LOAD' onStartupRunlevel='9' sequence='9'
onFail='resource.configuration.pluginFailed'/>
      <action do='STOP' onShutdownRunlevel='6' sequence='1'/>

      <attribute id='port'>9875</attribute>
   </plugin>

After restarting our server we can access it in the same way as we did
with the extra client described above.

A possible disadvantage is that we have an open read access to the mom
which can be used from many clients without authorization.
But the client checks for the word "get" in the beginning for the
request and stops immediately, if this is not given.
The client stops after every request as well.

The advantage of this client is, we only have one single connection to
the xmlBlaster and can connect many times.
Using telnet from many clients with the telnet-admin on port 2702 was
very resource consuming.


So , that's it for now, go and use it. Thanks for feedback.

Enjoy!

cheers

Heinrich

Reply via email to