Пример #1
0
        void MoveMessageToErrorTransport(IReceiveContext context, Exception exception = null)
        {
            var moveContext = new MoveMessageSendContext(context);

            if (exception != null)
            {
                moveContext.SetHeader("MT-Fault-Message", exception.Message);
                moveContext.SetHeader("MT-Fault-StackTrace", exception.StackTrace);
            }

            moveContext.SetHeader("MT-Error-Host", Environment.MachineName);
            moveContext.SetHeader("MT-Error-Process", Process.GetCurrentProcess().ProcessName);

            Assembly entryAssembly = Assembly.GetEntryAssembly();

            if (entryAssembly != null)
            {
                AssemblyName assemblyName = entryAssembly.GetName();
                moveContext.SetHeader("MT-Error-Assembly", assemblyName.Name);
            }

            _errorTransport.Send(moveContext);

            string messageId = context.OriginalMessageId ?? context.MessageId;

            _tracker.MessageWasMovedToErrorQueue(messageId);

            Address.LogMoved(_errorTransport.Address, context.MessageId, "");
        }
Пример #2
0
        void MoveMessageToErrorTransport(IReceiveContext context)
        {
            var moveContext = new MoveMessageSendContext(context);

            _errorTransport.Send(moveContext);

            string messageId = context.OriginalMessageId ?? context.MessageId;

            _tracker.MessageWasMovedToErrorQueue(messageId);

            Address.LogMoved(_errorTransport.Address, context.MessageId, "");
        }