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

[xmlblaster] RE: C client publish() in update() thread



>   Hi Marcel,
>
>    we are in charging of developing a business critical application, and
>after discovering xmlBlaster we are experimenting its functionalities.
>
>    We are using the C-Socket implentation for the connection to xmlBlaster,
>the functionalities required by our xmlBlaster clients are
>
>       1) Get asynchronous messages
>       2) do some processing
>       3) publishing a new message for another client
>
>    We tried to do the publishing inside the callback function ( like
>myUpdate in the examples)
>
>static bool myUpdate(MsgUnitArr *msgUnitArr, void *userData,
>XmlBlasterException *exception)
>{
>   .....................
>
>   MsgUnit m;
>
>  // here we create a message
>   XmlBlasterAccessUnparsed *xa = (XmlBlasterAccessUnparsed *)userData;
>
>   char *response = (char *)0;
>   XmlBlasterException xmlBlasterException;
>
>
>   response = xa->publish(xa, &m, &xmlBlasterException);
>
>   freeMsgUnitData(&m);
>   free(response);
>
>  ........................
>}
>
> but when we publish a message the   callback hangs  and after a while
>return these error messages
>
>[Tue Oct  7 11:57:42 2003 ERROR
>/home/myuser/xmlBlaster/src/c/socket/CallbackServerUnparsed.c] RequestId '3'
>is not registered
>/home/myuser/xmlBlaster/lib/libxmlBlasterClientC.so(getStackTrace+0x46)
>[0x4007b264]
>/home/myuser/mlBlaster/lib/libxmlBlasterClientC.so(xmlBlasterDefaultLogging+
>0x6f) [0x4007bde7]
>/home/myuser/xmlBlaster/lib/libxmlBlasterClientC.so [0x40076c5d]
>/home/myuser/xmlBlaster/lib/libxmlBlasterClientC.so [0x40076ebb]
>/lib/i686/libpthread.so.0 [0x40028881]
>/lib/i686/libc.so.6(__clone+0x57) [0x420e3887]
>
>[Tue Oct  7 11:57:42 2003 ERROR
>/home/myuser/xmlBlaster/src/c/socket/CallbackServerUnparsed.c] PANIC: Did
>not expect an INVOCATION 'R'='82' as a callback
>/home/myuser/xmlBlaster/lib/libxmlBlasterClientC.so(getStackTrace+0x46)
>[0x4007b264]
>/home/myuser/xmlBlaster/lib/libxmlBlasterClientC.so(xmlBlasterDefaultLogging
>+0x6f) [0x4007bde7]
>/home/myuser/xmlBlaster/lib/libxmlBlasterClientC.so [0x40076f97]
>/lib/i686/libpthread.so.0 [0x40028881]
>/lib/i686/libc.so.6(__clone+0x57) [0x420e3887]
>
>[Tue Oct  7 11:57:42 2003 ERROR
>/home/myuser/xmlBlaster/src/c/socket/CallbackServerUnparsed.c] Received
>unknown callback methodName=publish
>/home/myuser/xmlBlaster/lib/libxmlBlasterClientC.so(getStackTrace+0x46)
>[0x4007b264]
>/home/myuser/xmlBlaster/lib/libxmlBlasterClientC.so(xmlBlasterDefaultLogging
>+0x6f) [0x4007bde7]
>/home/myuser/xmlBlaster/lib/libxmlBlasterClientC.so [0x4007716d]
>/lib/i686/libpthread.so.0 [0x40028881]
>/lib/i686/libc.so.6(__clone+0x57) [0x420e3887]
>    We don't have any idea about this happens, and where is the problem.  Do
>you have any example of how to implement this functionality?>
>
>    Whilst using the Java API the publishing of a message from a callback
>works.
>
>    Do you think that is better to develop the clients using Java, are the
>Java APIs  more complete, stable ....?
>
>
>    Is it available an 'how to' document
>
>    Kindest regards
>
>     Settimio

Hi Settimio,

i expected something like the behavior as you experience, see
the TODO section hint:

  http://www.xmlblaster.org/xmlBlaster/doc/requirements/client.c.socket.html#todo

Publishing() within the update() thread will dead lock and after a timeout
of 60 sec you will see the above errors.
You need to open an own thread to do the publish or
implement a thread pool in our SOCKET C callback library
(and probably donate it to us :-).


The Java client library has a client side thread pool already, see property "dispatch/callback/plugin/socket/multiThreaded" at http://www.xmlblaster.org/xmlBlaster/doc/requirements/protocol.socket.html#configuration

The Java client library is the most sophisticated implementation
compared to the other libs for C, C++, Python and Perl.
It has features like client side persistence queues for swapping
of huge messsage backlogs and crash recovery, see the feature matrix at

  http://www.xmlblaster.org/FeatureMatrix.html

On the other hand the C library is tiny and high performing ...

best regards,


Marcel

--
http://www.xmlBlaster.org