コード例 #1
0
 public async Task PublishAsync(object message, IDictionary <string, string>?headers = default)
 {
     try
     {
         var bus = _serviceBusFactory.GetServiceBus(message.GetType());
         await bus.Publish(message, headers);
     }
     catch (RebusApplicationException e)
     {
         // This error is thrown sometimes when the transport tries to add another "OnCommitted" handler to the current transaction.
         // It looks like it's some form of race condition, and only seems to happen when publishing a message to all receivers (including the current bus)
         // Might reach out to @mookid8000 to get a better understanding
         _logger.LogWarning(e, "Failed to publish message {@Message}. This happens when the transaction context used by Rebus has already been completed. Should be fine", message);
     }
 }
コード例 #2
0
ファイル: CommandSender.cs プロジェクト: jruckert/elsa-core
 private IBus GetBus(object message, string?queueName) => _serviceBusFactory.GetServiceBus(message.GetType(), queueName);
コード例 #3
0
ファイル: EventPublisher.cs プロジェクト: yopichy/elsa-core
 public async Task PublishAsync(object message, IDictionary <string, string>?headers = default)
 {
     var bus = _serviceBusFactory.GetServiceBus(message.GetType());
     await bus.Publish(message, headers);
 }