static void OnAggregateSaved(CommandHandlerBase sender, IAggregate aggr, DomainCommand by)
 {
     if (by != null && aggr != null)
     {
         Console.WriteLine("[AGGR] {0} -> {1} -> {2}",
                           by.GetType().FullName,
                           aggr.GetType().FullName,
                           string.Join(", ", aggr.GetUncommittedEvents().OfType <object>().Select(e => e.GetType().FullName)));
     }
 }
Exemple #2
0
        public void PublishCommand(DomainCommand command)
        {
            var json            = JsonConvert.SerializeObject(command);
            var body            = Encoding.UTF8.GetBytes(json);
            var basicProperties = Model.CreateBasicProperties();

            basicProperties.Type      = command.GetType().Name;
            basicProperties.Timestamp = new AmqpTimestamp(command.Timestamp);
            Model.BasicPublish(string.Empty, command.DestinationQueue, false, basicProperties, body);
        }