public void OnMessageArrived(XmlBlasterLib.MessageUnit mu)
 {
     logger.Debug("OnMessageArrived()");
     try
     {
         // Appel asynchrone pour repasser sur le thread du Form...
         IAsyncResult ar = this.BeginInvoke(this.messagesFillDelegate, new object[] { new MessageUnit[1] {
                                                                                          mu
                                                                                      } });
     }
     catch (Exception ex)
     {
         logger.Debug("OnMessageArrived() Ex: " + ex.Message);
     }
 }
Пример #2
0
        public string Update(string cbSessionId, string key, System.Byte[] content, string qos)
        {
            string me = "Update()";

            logger.Debug(me);

            // refresh last server heartbeat
            pingLastTime = Environment.TickCount;

            // Note (from requirements/interface.update.html)
            //
            // Be prepared to receive all sorts of messages on update,
            // like normal messages or internal xmlBlaster messages or administrative command messages.
            //

            /*
             *      XmlBlasterCallback.Update() cbSessionId:
             *              unknown
             *      XmlBlasterCallback.Update() key:
             *              <key oid='__sys__UserList'>
             *                      <__sys__internal/>
             *              </key>
             *      XmlBlasterCallback.Update() qos:
             *              <qos>
             *                      <sender>/node/xmlBlaster_127_0_0_1_3412/client/__RequestBroker_internal[xmlBlaster_127_0_0_1_3412]/1</sender>
             *                      <subscribe id='__subId:xmlBlaster_127_0_0_1_3412-XPATH1132587264334000000'/>
             *                      <expiration lifeTime='-1'/>
             *                      <rcvTimestamp nanos='1132587264254000001'/>
             *                      <queue index='0' size='3'/>
             *                      <forceUpdate/>
             *                      <isPublish/>
             *              </qos>
             */

            /*
             * logger.Debug( "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv" );
             * logger.Debug( "{0} cbSessionId: {1}", me, cbSessionId ); // SecretSessionId, so should be 'Unknow'.
             * logger.Debug( "{0} key:\n{1}", me, key );
             * logger.Debug( "{0} qos:\n{1}", me, qos );
             * logger.Debug( "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" );
             */


            if (XmlBlasterCallback.messageArrived != null)
            {
                //string xml = Encoding.Default.GetString( msg );
                //XmlBlasterCallback.messageArrived( key, xml, qosUpdate.Sender, qosUpdate.SubscribeId );
                MessageUnit msg;
                try
                {
                    msg = new MessageUnit(key, content, qos);

                    try
                    {
                        //XmlBlasterCallback.messageArrived( msg );

                        //logger.Debug( "{0} InvocationList: {1}", me, XmlBlasterCallback.messageArrived.GetInvocationList().Length );
                        // Asynchronously invoke the method.
                        IAsyncResult ar = XmlBlasterCallback.messageArrived.BeginInvoke(msg, null, null);
                        //XmlBlasterCallback.messageArrived.EndInvoke(ar);
                    }
                    catch (Exception ex)
                    {
                        logger.Error("{0} Failed to fire messageArrived. Ex: {1}", me, ex.Message);
                    }
                }
                catch (Exception ex)
                {
                    logger.Error("{0} Received a malformed message. Ex: {1}", me, ex.Message);
                }
            }

            return("<qos><state>OK</state></qos>");
        }