Пример #1
0
        /// <summary>
        /// Invokes the subscriber for processing of the message.
        /// </summary>
        /// <param name="msg">A reference to the subscribed message.</param>
        public override void Invoke(MultiPartMessage msg)
        {
            ContextTraceListener contextListener = ((ContextTraceListener)MessageEngine.Instance.Tracing.Listeners["ContextTraceListener"]);

            if (contextListener != null)
            {
                contextListener.ResetContext();
            }
        }
Пример #2
0
        private void MessageReceivedEventHandler(object sender, AdapterReceiveEventArgs e)
        {
            ContextTraceListener contextListener = ((ContextTraceListener)MessageEngine.Instance.Tracing.Listeners["ContextTraceListener"]);

            if (contextListener != null)
            {
                contextListener.ResetContext();
            }
        }
Пример #3
0
        protected void UnhandledExceptionEventHandler(object sender, UnhandledExceptionEventArgs e)
        {
            ContextTraceListener contextListener = ((ContextTraceListener)MessageEngine.Instance.Tracing.Listeners["ContextTraceListener"]);

            if (contextListener != null)
            {
                contextListener.ResetContext();
            }

            if ((MessageEngine.Instance.Tracing.Switch.Level & SourceLevels.Critical) == SourceLevels.Critical)
            {
                MessageEngine.Instance.Tracing.TraceData(TraceEventType.Critical, 0, e.ExceptionObject);
            }
        }
Пример #4
0
        /// <summary>
        /// Called by the pipeline to invoke the component.
        /// </summary>
        /// <param name="msg">The message to process.</param>
        /// <returns>A collection of messages produced by this component.</returns>
        public override Collection <MultiPartMessage> Invoke(MultiPartMessage msg)
        {
            string serialNumber = msg.Properties.ReadAsString("SerialNumber");

            if (!CanProcess(msg))
            {
                ContextTraceListener contextListener = ((ContextTraceListener)MessageEngine.Instance.Tracing.Listeners["ContextTraceListener"]);

                if (contextListener != null)
                {
                    contextListener.ResetContext();
                }

                return(null);
            }

            Collection <MultiPartMessage> resultCollection = new Collection <MultiPartMessage>();

            resultCollection.Add(msg);

            return(resultCollection);
        }