void IQueueMessageHandler.Handle(QueueMessage queueMessage, IMessageContext context)
 {
     var applicationMessageType = _typeNameProvider.GetType(queueMessage.Tag);
     var message = _jsonSerializer.Deserialize(Encoding.UTF8.GetString(queueMessage.Body), applicationMessageType) as IApplicationMessage;
     var processContext = new EQueueProcessContext(queueMessage, context);
     var processingMessage = new ProcessingApplicationMessage(message, processContext);
     _processor.Process(processingMessage);
 }
Exemplo n.º 2
0
        void IQueueMessageHandler.Handle(QueueMessage queueMessage, IMessageContext context)
        {
            var messageType       = _typeCodeProvider.GetType(queueMessage.Code);
            var message           = _jsonSerializer.Deserialize(Encoding.UTF8.GetString(queueMessage.Body), messageType) as IApplicationMessage;
            var processContext    = new EQueueProcessContext(queueMessage, context);
            var processingMessage = new ProcessingApplicationMessage(message, processContext);

            _processor.Process(processingMessage);
        }
Exemplo n.º 3
0
        void IQueueMessageHandler.Handle(QueueMessage queueMessage, IMessageContext context)
        {
            var applicationMessageType = _typeNameProvider.GetType(queueMessage.Tag);
            var message           = _jsonSerializer.Deserialize(Encoding.UTF8.GetString(queueMessage.Body), applicationMessageType) as IApplicationMessage;
            var processContext    = new EQueueProcessContext(queueMessage, context);
            var processingMessage = new ProcessingApplicationMessage(message, processContext);

            _logger.InfoFormat("ENode application message received, messageId: {0}, routingKey: {1}", message.Id, message.GetRoutingKey());
            _processor.Process(processingMessage);
        }
Exemplo n.º 4
0
        void IQueueMessageHandler.Handle(QueueMessage queueMessage, IMessageContext context)
        {
            var applicationMessageType = _typeNameProvider.GetType(queueMessage.Tag);
            var message           = _jsonSerializer.Deserialize(Encoding.UTF8.GetString(queueMessage.Body), applicationMessageType) as IApplicationMessage;
            var processContext    = new EQueueProcessContext(queueMessage, context);
            var processingMessage = new ProcessingApplicationMessage(message, processContext);

            _logger.DebugFormat("ENode application message received, messageId: {0}", message.Id);

            Task.Factory.StartNew(obj =>
            {
                _messageDispatcher.DispatchMessageAsync(((ProcessingApplicationMessage)obj).Message).ContinueWith(x =>
                {
                    processingMessage.Complete();
                });
            }, processingMessage);
        }
Exemplo n.º 5
0
 void IQueueMessageHandler.Handle(QueueMessage queueMessage, IMessageContext context)
 {
     var exceptionMessage = _jsonSerializer.Deserialize<PublishableExceptionMessage>(Encoding.UTF8.GetString(queueMessage.Body));
     var exceptionType = _typeNameProvider.GetType(queueMessage.Tag);
     var exception = FormatterServices.GetUninitializedObject(exceptionType) as IPublishableException;
     exception.Id = exceptionMessage.UniqueId;
     exception.Timestamp = exceptionMessage.Timestamp;
     exception.RestoreFrom(exceptionMessage.SerializableInfo);
     var sequenceMessage = exception as ISequenceMessage;
     if (sequenceMessage != null)
     {
         sequenceMessage.AggregateRootTypeName = exceptionMessage.AggregateRootTypeName;
         sequenceMessage.AggregateRootStringId = exceptionMessage.AggregateRootId;
     }
     var processContext = new EQueueProcessContext(queueMessage, context);
     var processingMessage = new ProcessingPublishableExceptionMessage(exception, processContext);
     _publishableExceptionProcessor.Process(processingMessage);
 }
 void IQueueMessageHandler.Handle(QueueMessage queueMessage, IMessageContext context)
 {
     var exceptionMessage = _jsonSerializer.Deserialize<PublishableExceptionMessage>(Encoding.UTF8.GetString(queueMessage.Body));
     var exceptionType = _publishableExceptionTypeCodeProvider.GetType(exceptionMessage.ExceptionTypeCode);
     var exception = FormatterServices.GetUninitializedObject(exceptionType) as IPublishableException;
     exception.Id = exceptionMessage.UniqueId;
     exception.Timestamp = exceptionMessage.Timestamp;
     exception.RestoreFrom(exceptionMessage.SerializableInfo);
     var sequenceMessage = exception as ISequenceMessage;
     if (sequenceMessage != null)
     {
         sequenceMessage.AggregateRootTypeCode = exceptionMessage.AggregateRootTypeCode;
         sequenceMessage.AggregateRootId = exceptionMessage.AggregateRootId;
     }
     var processContext = new EQueueProcessContext(queueMessage, context);
     var processingMessage = new ProcessingPublishableExceptionMessage(exception, processContext);
     _publishableExceptionProcessor.Process(processingMessage);
 }
        void IQueueMessageHandler.Handle(QueueMessage queueMessage, IMessageContext context)
        {
            var exceptionMessage = _jsonSerializer.Deserialize <PublishableExceptionMessage>(Encoding.UTF8.GetString(queueMessage.Body));
            var exceptionType    = _typeNameProvider.GetType(queueMessage.Tag);
            var exception        = FormatterServices.GetUninitializedObject(exceptionType) as IPublishableException;

            exception.Id        = exceptionMessage.UniqueId;
            exception.Timestamp = exceptionMessage.Timestamp;
            exception.RestoreFrom(exceptionMessage.SerializableInfo);
            var processContext    = new EQueueProcessContext(queueMessage, context);
            var processingMessage = new ProcessingPublishableExceptionMessage(exception, processContext);

            _logger.DebugFormat("ENode exception message received, messageId: {0}, aggregateRootId: {1}, aggregateRootType: {2}", exceptionMessage.UniqueId, exceptionMessage.AggregateRootId, exceptionMessage.AggregateRootTypeName);

            Task.Factory.StartNew(obj =>
            {
                _messageDispatcher.DispatchMessageAsync(((ProcessingPublishableExceptionMessage)obj).Message).ContinueWith(x =>
                {
                    processingMessage.Complete();
                });
            }, processingMessage);
        }