Exemplo n.º 1
0
        private void OperationCompleteBroadcastCallFinishedHandler(Dispatcher dispatcher, IMessage message,
                                                                   ResultCollector resultCollector)
        {
            lock (resultCollector)
            {
                foreach (DictionaryEntry entry in resultCollector.Failed)
                {
                    string mbrUri = (string)entry.Key;
                    Exception ex = null;
                    if (entry.Value is Exception)
                    {
                        ex = (Exception)entry.Value;
                    }
                    else
                    {
                        ex = ((IMethodReturnMessage)entry.Value).Exception;
                    }
                    MarshalByRefObject failedObject =
                        dispatcher.FindObjectByUri(mbrUri);

                    Console.WriteLine(
                        "OperationCompleteBroadcastCallFinishedHandler: Receiver {0} has failed. Error: {1}",
                        mbrUri, ex.Message);
                    // here you have failed MBR object (failedObject)
                    // and Exception (ex)
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Called by broadcast dispatcher when all calls are performed.
 /// Does not undertake any actions.
 /// </summary>
 /// <param name="dispatcher">Source dipatcher.</param>
 /// <param name="message">Source message.</param>
 /// <param name="resultCollector">Call results.</param>
 public void BroadcastCallFinishedHandler(Dispatcher dispatcher, IMessage message, ResultCollector resultCollector)
 {
 }
Exemplo n.º 3
0
 /// <summary>
 /// Does absolutely nothing. If you want to enable async calls and do not need to process call results, use this stub as an event receiver.
 /// </summary>
 /// <param name="dispatcher">Ignored.</param>
 /// <param name="message">Ignored.</param>
 /// <param name="resultCollector">Ignored.</param>
 public void AsyncEventStub(Dispatcher dispatcher, IMessage message, ResultCollector resultCollector)
 {
 }
        /// <summary>
        /// Puts down a record describing a broadcast dispatcher.
        /// </summary>
        /// <param name="writeDispatcherSettings">A value indicating whether it is necessary to put down dispatcher's settings.</param>
        /// <param name="dispatcher">The broadcast dispatcher.</param>
        public void WriteDispatcherSettings(bool writeDispatcherSettings, Dispatcher dispatcher)
        {
            this.BinaryWriter.Write( (bool) writeDispatcherSettings );
            this.BinaryWriter.Write( (int) dispatcher.DbgDispatcherId );
            this.WriteString( dispatcher.DbgDispatcherName );

            if (! writeDispatcherSettings)
                return ;

            this.BinaryWriter.Write( true );
            this.WriteString("Interface");
            this.WriteString( dispatcher.SupportedInterface.ToString() );

            this.BinaryWriter.Write( true );
            this.WriteString("ReceiveResultsTimeOut");
            this.WriteString( dispatcher.ReceiveResultsTimeOut.TotalMilliseconds.ToString() );

            this.BinaryWriter.Write( true );
            this.WriteString("CallIsAsync");
            this.WriteString( dispatcher.CallIsAsync.ToString() );

            this.BinaryWriter.Write( true );
            this.WriteString("MaximumNumberOfConsecutiveFailsToExcludeReceiverAutomatically");
            this.WriteString( dispatcher.MaximumNumberOfConsecutiveFailsToExcludeReceiverAutomatically.ToString() );

            this.BinaryWriter.Write( true );
            this.WriteString("MaximumNumberOfConsecutiveFailsToEnableSimulationMode");
            this.WriteString( dispatcher.MaximumNumberOfConsecutiveFailsToEnableSimulationMode.ToString() );

            this.BinaryWriter.Write( true );
            this.WriteString("IgnoreRecurrentCalls");
            this.WriteString( dispatcher.IgnoreRecurrentCalls.ToString() );

            this.BinaryWriter.Write( true );
            this.WriteString("Local URI base");
            this.WriteString( GenuineUtility.DefaultHostIdentifier.ToString("N") );

            this.BinaryWriter.Write( false );
        }
        /// <summary>
        /// Puts down a record describing a general Genuine Channels event.
        /// </summary>
        /// <param name="logCategory">The category of the event.</param>
        /// <param name="author">The author.</param>
        /// <param name="type">The type of the event(Subcategory).</param>
        /// <param name="exception">The exception associated with the event.</param>
        /// <param name="message">The message associated with the event.</param>
        /// <param name="remote">The remote host participating in the event.</param>
        /// <param name="content">The content associated with the record.</param>
        /// <param name="sourceThreadId">The id of the thread where the invocation was made.</param>
        /// <param name="sourceThreadName">The name of the thread.</param>
        /// <param name="securitySession">The Security Session.</param>
        /// <param name="securitySessionName">The name of the Security Session</param>
        /// <param name="writeDispatcherSettings">A value indicating whether it is necessary to put down broadcast dispatcher's settings.</param>
        /// <param name="dispatcher">The broadcast dispatcher.</param>
        /// <param name="resultCollector">The broadcast result collector.</param>
        /// <param name="writeReceiverInfoSettings">A value indicating whether it is necessary to put down information about the specified broadcast recipient.</param>
        /// <param name="receiverInfo">The broadcast recipient.</param>
        /// <param name="string1">The first string that elaborates the current event.</param>
        /// <param name="string2">The second string that elaborates the current event.</param>
        /// <param name="description">The description of the event.</param>
        /// <param name="parameters">Parameters to the description.</param>
        public void WriteBroadcastEngineEvent(LogCategory logCategory, string author, LogMessageType type, Exception exception, 
            Message message, HostInformation remote, Stream content, int sourceThreadId, string sourceThreadName,
            SecuritySession securitySession, string securitySessionName,
            bool writeDispatcherSettings, Dispatcher dispatcher, ResultCollector resultCollector, bool writeReceiverInfoSettings,
            ReceiverInfo receiverInfo, string string1, string string2, string description, params object[] parameters)
        {
            if (dispatcher == null)
            {
                this.WriteImplementationWarningEvent("BinaryLogWriter.WriteBroadcastEngineEvent", LogMessageType.Error, null,
                    sourceThreadId, sourceThreadName, "The reference is null. Stack trace: " + Environment.StackTrace);
                return ;
            }

            lock (this._streamLock)
            {
                this.WriteRecordHeader(BinaryRecordVersion.TransportBroadcastEngineRecord, logCategory, type, author);
                this.WriteException( exception );

                this.WriteMessageSeqNo( message );
                this.WriteHostInformationId( remote );
                this.WriteBinaryContent( content );

                this.BinaryWriter.Write( (int) sourceThreadId);
                this.WriteString( sourceThreadName );

                this.WriteSecuritySessionId( securitySession );
                this.WriteString( securitySessionName );

                this.WriteResultCollectorId(resultCollector);
                this.WriteDispatcherSettings(writeDispatcherSettings, dispatcher);
                this.WriteReceiverInfo(writeReceiverInfoSettings, receiverInfo);

                this.WriteString( string1 );
                this.WriteString( string2 );
                this.WriteStringWithParameters( description, parameters);

                this.BinaryWriter.Flush();
            }
        }
 /// <summary>
 /// Constructs an instance of the BroadcastProxy class.
 /// </summary>
 /// <param name="interfaceToSupport">The object representing a well-known interface which is supported by all receivers.</param>
 /// <param name="dispatcher">The instance of the Dispatcher class containing a list of the receivers.</param>
 public BroadcastProxy(Type interfaceToSupport, Dispatcher dispatcher)
     : base(interfaceToSupport)
 {
     this._dispatcher = dispatcher;
 }