コード例 #1
0
        public void Send(DomainEventHandledMessage message, string topic)
        {
            var messageJson   = _jsonSerializer.Serialize(message);
            var messageBytes  = Encoding.UTF8.GetBytes(messageJson);
            var equeueMessage = new EQueueMessage(topic, (int)EQueueMessageTypeCode.DomainEventHandledMessage, messageBytes);

            _ioHelper.TryIOActionRecursively("DomainEventHandledMessage", () => messageJson, () =>
            {
                _ioHelper.TryIOAction(() => _producer.SendAsync(equeueMessage, message.CommandId), "DomainEventHandledMessageAsync");
            });
        }
コード例 #2
0
 private void ProcessDomainEventHandledMessage(DomainEventHandledMessage message)
 {
     if (_commandTaskDict.TryRemove(message.CommandId, out CommandTaskCompletionSource commandTaskCompletionSource))
     {
         var commandResult = new CommandResult(CommandStatus.Success, message.CommandId, message.AggregateRootId, message.CommandResult, message.CommandResult != null ? typeof(string).FullName : null);
         if (commandTaskCompletionSource.TaskCompletionSource.TrySetResult(commandResult))
         {
             _logger.InfoFormat("Command result return, {0}", commandResult);
         }
     }
 }
コード例 #3
0
 private void ProcessDomainEventHandledMessage(DomainEventHandledMessage message)
 {
     CommandTaskCompletionSource commandTaskCompletionSource;
     if (_commandTaskDict.TryRemove(message.CommandId, out commandTaskCompletionSource))
     {
         var commandResult = new CommandResult(CommandStatus.Success, message.CommandId, message.AggregateRootId, message.CommandResult, message.CommandResult != null ? typeof(string).FullName : null);
         if (commandTaskCompletionSource.TaskCompletionSource.TrySetResult(new AsyncTaskResult<CommandResult>(AsyncTaskStatus.Success, commandResult)))
         {
             if (_logger.IsDebugEnabled)
             {
                 _logger.DebugFormat("Command result return, {0}", commandResult);
             }
         }
     }
 }
コード例 #4
0
 public void Send(DomainEventHandledMessage message, string topic)
 {
     _producer.SendAsync(new Message(topic, _binarySerializer.Serialize(message)), message.AggregateRootId);
 }