private async Task sendBySession(Envelope envelope) { try { var message = _protocol.WriteFromEnvelope(envelope); message.SessionId = Guid.NewGuid().ToString(); if (envelope.IsDelayed(DateTime.UtcNow)) { await _sender.ScheduleMessageAsync(message, envelope.ExecutionTime.Value); } else { await _sender.SendAsync(message); } await _callback.Successful(envelope); } catch (Exception e) { try { await _callback.ProcessingFailure(envelope, e); } catch (Exception exception) { _logger.LogException(exception); } } }
public Task Send(Envelope envelope) { var message = _protocol.WriteFromEnvelope(envelope); message.SessionId = Guid.NewGuid().ToString(); if (envelope.IsDelayed(DateTime.UtcNow)) { return(_sender.ScheduleMessageAsync(message, envelope.ExecutionTime.Value)); } return(_sender.SendAsync(message)); }
public Task <long> ScheduleMessageAsync(Message message, DateTimeOffset scheduleEnqueueTimeUtc) { return(_client.ScheduleMessageAsync(message, scheduleEnqueueTimeUtc)); }
private Task PublishMessageAsync(Message message, ISenderClient client, int?delayInSeconds = null) { return(delayInSeconds.HasValue ? client.ScheduleMessageAsync(message, DateTime.UtcNow.AddSeconds(delayInSeconds.Value)) : client.SendAsync(message)); }