Exemple #1
0
 public void LogErrorReport(ErrorReport report)
 {
     if (!_settings.PersistDeadLetterEnvelopes)
     {
         return;
     }
     _logErrorReportBatching.Post(report);
 }
Exemple #2
0
        public bool Enqueue(Envelope message)
        {
            if (_outgoing == null)
            {
                throw new InvalidOperationException("This agent has not been started");
            }

            _outgoing.Post(message);

            return(true);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
 public void ScheduleExecution(Envelope envelope)
 {
     _scheduleIncomingBatching.Post(envelope);
 }
Exemple #5
0
 public void DeleteOutgoing(Envelope envelope)
 {
     _deleteOutgoingBatching.Post(envelope);
 }
Exemple #6
0
 public void DeleteIncoming(Envelope envelope)
 {
     _deleteIncomingBatching.Post(envelope);
 }