public async Task Send(SendEndpointContext clientContext) { var context = new AzureServiceBusSendContext <T>(_message, _cancellationToken); try { await _pipe.Send(context).ConfigureAwait(false); CopyIncomingIdentifiersIfPresent(context); if (IsCancelScheduledSend(context, out var sequenceNumber)) { await CancelScheduledSend(clientContext, sequenceNumber).ConfigureAwait(false); return; } if (context.ScheduledEnqueueTimeUtc.HasValue) { var scheduled = await ScheduleSend(clientContext, context).ConfigureAwait(false); if (scheduled) { return; } } await _observer.PreSend(context).ConfigureAwait(false); var brokeredMessage = CreateBrokeredMessage(context); await clientContext.Send(brokeredMessage).ConfigureAwait(false); context.LogSent(); await _observer.PostSend(context).ConfigureAwait(false); } catch (Exception ex) { await _observer.SendFault(context, ex).ConfigureAwait(false); throw; } }
public Task SendFault(SendContext <T> context, Exception exception) { return(_observer.SendFault(context, exception)); }