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);
 }
        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);
        }
Beispiel #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);
        }
        void IKafkaMessageHandler.Handle(KafkaMessage message, IKafkaMessageContext context)
        {
            var eNodeMessage           = _jsonSerializer.Deserialize <ENodeMessage>(message.Value);
            var applicationMessageType = _typeNameProvider.GetType(eNodeMessage.Tag);
            var applicationMessage     = _jsonSerializer.Deserialize(eNodeMessage.Body, applicationMessageType) as IApplicationMessage;
            var processContext         = new KafkaMessageProcessContext(message, context);
            var processingMessage      = new ProcessingApplicationMessage(applicationMessage, processContext);

            _logger.InfoFormat("ENode application message received, messageId: {0}, routingKey: {1}", applicationMessage.Id, applicationMessage.GetRoutingKey());
            _processor.Process(processingMessage);
        }
Beispiel #5
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);
        }