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

Re: [xmlblaster-devel] pure Python implementation of Socket protocol



Hi Brad,

Colin Brown once had a more or less functional python SOCKET protocol
implementation, here you can download the last version i've got
from his code:

  http://www.xmlblaster.org/xmlblastersocket.zip

To have threaded and blocking-mode variants is certainly valuable.

Good luck,

Marcel


Brad Clements wrote:
Has anyone worked on a Python implementation of the Socket protocol?

Either in pure python or C shim?

I am thinking about writing one, though I think it's API will be different than pyBlaster.

Also, I need the flexability to work in threaded or non-threaded mode with blocking or non-blocking sockets.

Anyone done this?



PS: Here some old emails with Colin Brown
====================================

Ahhh! Maybe the documentation is lacking here somewhat. My interpretation of
the documentation on the requestID:

"An identifier of this request (unique in client scope), the return message
will contain this ID. The server bounces this requestId back, it does not
use it. This is useful for the client to find out which response belongs to
which request."

is that the requestID is not used by the server AT ALL and is solely for the
client to track the messaging.

From what you have said below: "Return the requestID that xmlBlaster sends
to you" says to me that the server DOES care what is in the requestID for an
acknowledgement ;-)


I know the documentation says "(unique in client scope)", but I am still
unclear as to whether or not this is compulsory or optional. My reasoning
was that if the server did not use it then for my tests I would leave it
blank to make sure the specs were being followed.

Cheers
Colin Brown
( We programmers can be so literal/pedantic sometimes, but that is the
nature of the game )

RE:
Your Python SOCKET clients are very smart and tiny!
Could you imagine to complete it and add some comments or docu and tests
and add it to xmlBlaster under LGPL license?

No problem: I would like to get socket, xml, soap and corba examples all
going in Python because, as you say,
they are simple to follow and can be easily arranged to demonstrate the many
modes of operation. My level of
commitment will depend on whether management decides to use xmlBlaster

within the company.


=================================================


am evaluating xmlBlaster for our organisation and we will need to use the socket interface
to communicate with some of our legacy (Fortran) code.


The specification of the socket protocol looks easy enough to implement so I have tried
writing some simple test examples using Python to check out the socket conversation.


Code and logfile outputs attached.

Thanks for any assistance.
Colin Brown

The setup is:

Linux Server: (info from xmlBlaster dump)
versionInfo=version=0.903,os.name=Linux,os.version=2.4.21-15.0.3.ELsmp,java.vm.vendor=Sun Microsystems Inc.,java.vm.version=1.3.1_02-b02,os.arch=i386,build.timestamp=05/12/2004 11:58 PM,build.java.vendor=IBM Corporation,build.java.version=1.3.1


running (unconfigured xmlBlaster - no security settings):
/home/oracle/jre/1.3.1/bin/java -jar lib/xmlBlaster.jar -logConsole false -useKeyboard false >> xmlblaster_log.txt 2>&1 &


Windows 2000 client, Python 2.3

RUNNING THE TESTS:
1. Publish/get works fine.
2. Connect with callback suceeds, but there are warning messages in the xmlBlaster logfile
that I cannot figure out how to handle. The 04:47:17 entry is my attempt to eliminate the
04:47:18 warnings.
3. Connect with oneway callback fails horribly at the Server with Java Null-pointer exceptions.
4. RPC works (once), but I suspect callback acknowledgement problems as in 2 above.


OUTPUT from 2 above:
C:\Documents and Settings\cbrown\Desktop\xmlblaster\xmlblastersocket>python examples.py


   1   test publish/get
   2   test connect with callback
   3   test connect with oneway callback
   4   test remote procedure call

Enter number to test:2

WR: " 370\x00\x00I\x00\x001\x00connect\x00\x00\x00<qos>\n <securityServic
e type='htpasswd' version='1.0'>\n <user>conncb_Tue Aug 24 16:47:15 2004</use
r>\n <passwd>xyz</passwd>\n </securityService>\n <ptp>true</ptp>\n <queue
relating='callback' maxEntries='100' maxEntriesCache='100'>\n <callback type=
'SOCKET'>\n </callback>\n </queue>\n <address type='SOCKET'>\n </address>\
n</qos>\x00\x000\x00"


RD: ' 855\x00\x00R\x00\x001179\x00connect\x00sessionId:10.10.194.2-null-10
93322837709-66380214-63\x00\x00\n <qos>\n <securityService type="htpasswd" vers
ion="1.0"><![CDATA[\n <user>conncb_Tue Aug 24 16:47:15 2004</user>\n <passwd
>xyz</passwd>\n ]]></securityService>\n <ptp/>\n <session name=\'/node/xmlBla
ster_10_10_194_2_3412/client/conncb_Tue Aug 24 16:47:15 2004/-62\' timeout=\'864
00000\' maxSessions=\'10\' clearSessions=\'false\' reconnectSameClientOnly=\'fal
se\' sessionId=\'sessionId:10.10.194.2-null-1093322837709-66380214-63\'/>\n <qu
eue relating=\'connection\' maxEntries=\'10000000\' maxEntriesCache=\'1000\'>\n
<address type=\'SOCKET\' dispatchPlugin=\'undef\'>\n \n </address>\n </q
ueue>\n <queue relating=\'subject\'/>\n <queue relating=\'callback\' maxEntrie
s=\'100\' maxEntriesCache=\'100\'>\n <callback type=\'SOCKET\' dispatchPlugin=
\'undef\'>\n \n </callback>\n </queue>\n </qos>\x00\x000\x00'


WR: " 135\x00\x00I\x00\x001\x00subscribe\x00sessionId:10.10.194.2-null-109
3322837709-66380214-63\x00\x00<qos/>\x00<key oid='trivia_Tue Aug 24 16:47:15 200
4'/>\x000\x00"


RD: " 178\x00\x00R\x00\x001180\x00subscribe\x00sessionId:10.10.194.2-null-
1093322837709-66380214-63\x00\x00\n <qos>\n <subscribe id='__subId:xmlBlaster_1
0_10_194_2_3412-16'/>\n <isSubscribe/>\n </qos>\x00\x000\x00"


WR: " 145\x00\x00I\x00\x001\x00publish\x00sessionId:10.10.194.2-null-10933
22837709-66380214-63\x00\x00<qos/>\x00<key oid='trivia_Tue Aug 24 16:47:15 2004'
/>\x0011\x00big fat cat"


RD: " 208\x00\x00R\x00\x001181\x00publish\x00sessionId:10.10.194.2-null-10
93322837709-66380214-63\x00\x00\n <qos>\n <key oid='trivia_Tue Aug 24 16:47:15
2004'/>\n <rcvTimestamp nanos='1093322837751000000'/>\n <isPublish/>\n </qos>\x
00\x000\x00"


RD: " 376\x00\x00I\x00\x001conncb_Tue Aug 24 16:47:15 2004:182\x00update\x
00unknown\x00\x00\n <qos>\n <sender>/node/xmlBlaster_10_10_194_2_3412/client/co
nncb_Tue Aug 24 16:47:15 2004/-62</sender>\n <subscribe id='__subId:xmlBlaster_
10_10_194_2_3412-16'/>\n <rcvTimestamp nanos='1093322837751000000'/>\n <queue
index='0' size='1'/>\n </qos>\x00\n <key oid='trivia_Tue Aug 24 16:47:15 2004'/>
\x0011\x00big fat cat"


WR: ' 95\x00\x00R\x00\x001unknown\x00update\x00sessionId:10.10.194.2-null
-1093322837709-66380214-63\x00\x00<qos/>\x00\x000\x00'


WR: ' 185\x00\x00I\x00\x001\x00disconnect\x00sessionId:10.10.194.2-null-10
93322837709-66380214-63\x00\x00<qos>\n <deleteSubjectQueue>true</deleteSubjectQ
ueue>\n <clearSessions>false</clearSessions>\n</qos>\x00\x000\x00'


RD: '' <--------------- A null string (ie TCP session has been closed by remote user)

C:\Documents and Settings\cbrown\Desktop\xmlblaster\xmlblastersocket>

xmlBlaster logfile:

[24/08/2004 04:47:17 INFO XmlBlaster.SOCKET.HandleClient-conncb_Tue Aug 24 16:47:15 2004 SOCKET-HandleClientRequest-conncb_Tue Aug 24 16:47:15 2004] SOCKET client connected, coming from host=cbrown.met.co.nz/10.10.192.140 port=1342
[24/08/2004 04:47:17 INFO XmlBlaster.SOCKET.HandleClient-conncb_Tue Aug 24 16:47:15 2004 DispatchConnection-callback:/node/xmlBlaster_10_10_194_2_3412/client/conncb_Tue Aug 24 16:47:15 2004/-62] Connection 'SOCKET' transition UNDEF -> ALIVE: Success, callback:/node/xmlBlaster_10_10_194_2_3412/client/conncb_Tue Aug 24 16:47:15 2004/-62 connected.
[24/08/2004 04:47:17 INFO XmlBlaster.SOCKET.HandleClient-conncb_Tue Aug 24 16:47:15 2004 Authenticate-/node/xmlBlaster_10_10_194_2_3412] Successful login for client /node/xmlBlaster_10_10_194_2_3412/client/conncb_Tue Aug 24 16:47:15 2004/-62, session expires after [ 24 h 0 millis ], 1 of 10 sessions are in use.
[24/08/2004 04:47:17 INFO XmlBlaster.SOCKET.HandleClient-conncb_Tue Aug 24 16:47:15 2004 XmlKey] DOM parsed the XmlKey trivia_Tue Aug 24 16:47:15 2004
[24/08/2004 04:47:17 INFO XmlBlaster.SOCKET.HandleClient-conncb_Tue Aug 24 16:47:15 2004 TopicHandler-/node/xmlBlaster_10_10_194_2_3412/topic/trivia_Tue Aug 24 16:47:15 2004] New topic is ready, history/maxEntries=10, persistence/msgUnitStore/maxEntries=100000000
[24/08/2004 04:47:17 WARN XmlBlaster.SOCKET.HandleClient-conncb_Tue Aug 24 16:47:15 2004 SocketExecutor] Ignoring received 'update' message id=unknown, nobody is interested in it
[24/08/2004 04:47:17 INFO XmlBlaster.SOCKET.HandleClient-conncb_Tue Aug 24 16:47:15 2004 Authenticate-/node/xmlBlaster_10_10_194_2_3412] Sleeping cb.disconnect.pending.sleep=1000 millis in disconnect(/node/xmlBlaster_10_10_194_2_3412/client/conncb_Tue Aug 24 16:47:15 2004/-62) to deliver 1 pending messages ...
[24/08/2004 04:47:18 INFO XmlBlaster.SOCKET.HandleClient-conncb_Tue Aug 24 16:47:15 2004 Authenticate-/node/xmlBlaster_10_10_194_2_3412] Disconnecting client /node/xmlBlaster_10_10_194_2_3412/client/conncb_Tue Aug 24 16:47:15 2004/-62, instanceId=-62, secretSessionId=sessionId:10.10.194.2-null-1093322837709-66380214-63
[24/08/2004 04:47:18 INFO XmlBlaster.SOCKET.HandleClient-conncb_Tue Aug 24 16:47:15 2004 SubjectInfo-60-/node/xmlBlaster_10_10_194_2_3412/client/conncb_Tue Aug 24 16:47:15 2004] Destroying SubjectInfo /node/xmlBlaster_10_10_194_2_3412/client/conncb_Tue Aug 24 16:47:15 2004. Nobody is logged in and no queue entries available
[24/08/2004 04:47:18 WARN XmlBlaster.SOCKET.HandleClient-conncb_Tue Aug 24 16:47:15 2004 org.xmlBlaster.util.queue.cache.CacheQueueInterceptorPlugin-callback:/node/xmlBlaster_10_10_194_2_3412/client/conncb_Tue Aug 24 16:47:15 2004/-62] Shutting down cache queue which contains 1 transient messages
[24/08/2004 04:47:18 WARN XmlBlaster.SOCKET.HandleClient-conncb_Tue Aug 24 16:47:15 2004 SOCKET-HandleClientRequest-conncb_Tue Aug 24 16:47:15 2004] There are 1 messages pending without a response, request IDs are conncb_Tue Aug 24 16:47:15 2004:182
[24/08/2004 04:47:19 INFO XmlBlaster.SOCKET.HandleClient-conncb_Tue Aug 24 16:47:15 2004 Authenticate-/node/xmlBlaster_10_10_194_2_3412] loginNameSubjectInfoMap has 7 entries and sessionInfoMap has 6 entries