public void Handle(RetryAllInGroup message)
        {
            if (Retries == null)
            {
                log.Warn($"Attempt to retry a group ({message.GroupId}) when retries are disabled");
                return;
            }

            FailureGroupView group;

            using (var session = Store.OpenSession())
            {
                group = session.Query <FailureGroupView, FailureGroupsViewIndex>()
                        .FirstOrDefault(x => x.Id == message.GroupId);
            }

            string originator = null;

            if (@group?.Title != null)
            {
                originator = group.Title;
            }

            var started = message.Started ?? DateTime.UtcNow;

            RetryOperationManager.Wait(message.GroupId, RetryType.FailureGroup, started, originator, group?.Type, group?.Last);
            Retries.StartRetryForIndex <FailureGroupMessageView, FailedMessages_ByGroup>(message.GroupId, RetryType.FailureGroup, started, x => x.FailureGroupId == message.GroupId, originator, group?.Type);
        }
        dynamic RetryAllGroupErrors(string groupId)
        {
            if (String.IsNullOrWhiteSpace(groupId))
            {
                return(HttpStatusCode.BadRequest);
            }

            var started = DateTime.UtcNow;

            if (!RetryOperationManager.IsOperationInProgressFor(groupId, RetryType.FailureGroup))
            {
                RetryOperationManager.Wait(groupId, RetryType.FailureGroup, started);

                Bus.SendLocal(new RetryAllInGroup {
                    GroupId = groupId, Started = started
                });
            }

            return(HttpStatusCode.Accepted);
        }
예제 #3
0
 public RetryProcessor(ISendMessages sender, IBus bus, ReturnToSenderDequeuer returnToSender, RetryOperationManager retryOperationManager)
 {
     this.sender                = sender;
     this.bus                   = bus;
     this.returnToSender        = returnToSender;
     this.retryOperationManager = retryOperationManager;
 }