public void LogErrorReport(ErrorReport report) { if (!_settings.PersistDeadLetterEnvelopes) { return; } _logErrorReportBatching.Post(report); }
public bool Enqueue(Envelope message) { if (_outgoing == null) { throw new InvalidOperationException("This agent has not been started"); } _outgoing.Post(message); return(true); }
public void Start(ISenderCallback callback) { _callback = callback; _sender = new ActionBlock <OutgoingMessageBatch>(SendBatch, new ExecutionDataflowBlockOptions { MaxDegreeOfParallelism = 1, CancellationToken = _cancellation }); _serializing = new ActionBlock <Envelope>(e => { try { e.EnsureData(); _batching.Post(e); } catch (Exception ex) { _logger.LogException(ex, message: $"Error while trying to serialize envelope {e}"); } }, new ExecutionDataflowBlockOptions { CancellationToken = _cancellation }); _batchWriting = new TransformBlock <Envelope[], OutgoingMessageBatch>( envelopes => { var batch = new OutgoingMessageBatch(Destination, envelopes); _queued += batch.Messages.Count; return(batch); }); _batchWriting.LinkTo(_sender); _batching = new BatchingBlock <Envelope>(200, _batchWriting, _cancellation); }
public void ScheduleExecution(Envelope envelope) { _scheduleIncomingBatching.Post(envelope); }
public void DeleteOutgoing(Envelope envelope) { _deleteOutgoingBatching.Post(envelope); }
public void DeleteIncoming(Envelope envelope) { _deleteIncomingBatching.Post(envelope); }