Beispiel #1
0
        public void Consume(WorkerAvailable <T> message)
        {
            WorkerDetails worker = _workers.Retrieve(message.ControlUri, () =>
            {
                return(new WorkerDetails
                {
                    ControlUri = message.ControlUri,
                    DataUri = message.DataUri,
                    InProgress = message.InProgress,
                    InProgressLimit = message.InProgressLimit,
                    Pending = message.Pending,
                    PendingLimit = message.PendingLimit,
                    LastUpdate = message.Updated,
                });
            });

            worker.UpdateInProgress(message.InProgress, message.InProgressLimit, message.Pending, message.PendingLimit, message.Updated);
        }
Beispiel #2
0
        public void Consume(T message)
        {
            WorkerDetails worker = _selectionStrategy.GetAvailableWorkers(_workers.Values, message, false).FirstOrDefault();

            if (worker == null)
            {
                CurrentMessage.RetryLater();
                return;
            }

            worker.Add();

            IEndpoint endpoint = _endpointFactory.GetEndpoint(worker.DataUri);

            var distributed = new Distributed <T>(message, CurrentMessage.Headers.ResponseAddress);

            endpoint.Send(distributed);
        }