Example #1
0
 internal BackoffSupervisorBase(Props childProps, string childName, IBackoffReset reset, object replyWhileStopped = null, Func <object, bool> finalStopMessage = null)
 {
     ChildProps        = childProps;
     ChildName         = childName;
     Reset             = reset;
     ReplyWhileStopped = replyWhileStopped;
     FinalStopMessage  = finalStopMessage;
     Log = Logging.GetLogger(Context.System, GetType());
 }
        /// <summary>
        /// Overload for users who ARE ALREADY USING <see cref="IConfirmableMessage"/> by the time the message
        /// is received by the <see cref="PersistenceSupervisor"/>.
        ///
        /// If a message is received by the <see cref="PersistenceSupervisor"/> without being decorated by <see cref="IConfirmableMessage"/>,
        /// under this configuration we will automatically package your message inside a <see cref="ConfirmableMessageEnvelope"/>.
        /// </summary>
        /// <param name="childProps"></param>
        /// <param name="childName"></param>
        /// <param name="reset"></param>
        /// <param name="finalStopMsg"></param>
        /// <param name="strategy"></param>
        /// <remarks>
        /// Read the manual. Seriously.
        /// </remarks>
        /// <returns></returns>
        public static Props PropsFor(Props childProps, string childName, IBackoffReset reset = null,
                                     Func <object, bool> finalStopMsg = null,
                                     SupervisorStrategy strategy      = null)
        {
            var config =
                new PersistenceSupervisionConfig(null, null, reset, finalStopMessage: finalStopMsg);

            return(Props.Create(() => new PersistenceSupervisor(childProps, childName, config,
                                                                strategy ?? Actor.SupervisorStrategy.StoppingStrategy)));
        }
Example #3
0
 public BackoffOptionsImpl(IBackoffType backoffType, Props childProps, string childName, TimeSpan minBackoff, TimeSpan maxBackoff, double randomFactor, IBackoffReset reset, OneForOneStrategy strategy)
 {
     _backoffType  = backoffType ?? RestartImpliesFailure.Instance;
     _childProps   = childProps;
     _childName    = childName;
     _minBackoff   = minBackoff;
     _maxBackoff   = maxBackoff;
     _randomFactor = randomFactor;
     _reset        = reset ?? new AutoReset(_minBackoff);
     _strategy     = strategy;
 }
Example #4
0
 public BackoffOptionsImpl(IBackoffType backoffType, Props childProps, string childName, TimeSpan minBackoff, TimeSpan maxBackoff, double randomFactor, IBackoffReset reset, OneForOneStrategy strategy, object replyWhileStopped = null, Func <object, bool> finalStopMessage = null)
 {
     _backoffType       = backoffType ?? RestartImpliesFailure.Instance;
     _childProps        = childProps;
     _childName         = childName;
     _minBackoff        = minBackoff;
     _maxBackoff        = maxBackoff;
     _randomFactor      = randomFactor;
     _reset             = reset ?? new AutoReset(_minBackoff);
     _strategy          = strategy;
     _replyWhileStopped = replyWhileStopped;
     _finalStopMessage  = finalStopMessage;
 }
Example #5
0
 public BackoffOnRestartSupervisor(
     Props childProps,
     string childName,
     TimeSpan minBackoff,
     TimeSpan maxBackoff,
     IBackoffReset reset,
     double randomFactor,
     OneForOneStrategy strategy) : base(childProps, childName, reset)
 {
     _minBackoff   = minBackoff;
     _maxBackoff   = maxBackoff;
     _randomFactor = randomFactor;
     _strategy     = strategy;
 }
Example #6
0
 public BackoffOnRestartSupervisor(
     Props childProps,
     string childName,
     TimeSpan minBackoff,
     TimeSpan maxBackoff,
     IBackoffReset reset,
     double randomFactor,
     OneForOneStrategy strategy,
     object replyWhileStopped             = null,
     Func <object, bool> finalStopMessage = null) : base(childProps, childName, reset, replyWhileStopped, finalStopMessage)
 {
     _minBackoff   = minBackoff;
     _maxBackoff   = maxBackoff;
     _randomFactor = randomFactor;
     _strategy     = strategy;
 }
Example #7
0
 public PersistenceSupervisionConfig(Func <object, bool> isEvent = null,
                                     Func <object, long, IConfirmableMessage> makeEventConfirmable = null,
                                     IBackoffReset resetBackoff = null,
                                     TimeSpan?minBackoff        = null,
                                     TimeSpan?maxBackoff        = null,
                                     double?randomFactor        = null, Func <object, bool> finalStopMessage = null)
 {
     IsEvent = isEvent;
     MakeEventConfirmable =
         makeEventConfirmable;
     Reset            = resetBackoff ?? AutoReset.Default;
     MinBackoff       = minBackoff ?? DefaultMinBackoff;
     MaxBackoff       = maxBackoff ?? DefaultMaxBackoff;
     RandomFactor     = randomFactor ?? DefaultRandomFactor;
     FinalStopMessage = finalStopMessage;
 }
Example #8
0
 public PersistenceSupervisionConfig(Func <object, bool> isEvent,
                                     Func <object, long, IConfirmableMessage> makeEventConfirmable,
                                     IBackoffReset resetBackoff = null,
                                     TimeSpan?minBackoff        = null,
                                     TimeSpan?maxBackoff        = null,
                                     double?randomFactor        = null, Func <object, bool> finalStopMessage = null)
 {
     IsEvent = isEvent ?? throw new ArgumentNullException(nameof(isEvent));
     MakeEventConfirmable =
         makeEventConfirmable ?? throw new ArgumentNullException(nameof(makeEventConfirmable));
     Reset            = resetBackoff ?? AutoReset.Default;
     MinBackoff       = minBackoff ?? DefaultMinBackoff;
     MaxBackoff       = maxBackoff ?? DefaultMaxBackoff;
     RandomFactor     = randomFactor ?? DefaultRandomFactor;
     FinalStopMessage = finalStopMessage;
 }
Example #9
0
 public BackoffOptionsImpl(IBackoffType backoffType, Props childProps, string childName, TimeSpan minBackoff, TimeSpan maxBackoff, double randomFactor, IBackoffReset reset = null)
     : this(backoffType, childProps, childName, minBackoff, maxBackoff, randomFactor, reset, new OneForOneStrategy(SupervisorStrategy.DefaultDecider))
 {
 }
Example #10
0
 internal BackoffSupervisorBase(Props childProps, string childName, IBackoffReset reset)
 {
     ChildProps = childProps;
     ChildName  = childName;
     Reset      = reset;
 }
        public static Props PropsFor(Func <object, long, IConfirmableMessage> makeConfirmable,
                                     Func <object, bool> isEvent,
                                     Func <IActorRef, Props> childPropsFactory, string childName, IBackoffReset reset = null, Func <object, bool> finalStopMsg = null,
                                     SupervisorStrategy strategy = null)
        {
            var config =
                new PersistenceSupervisionConfig(isEvent, makeConfirmable, reset, finalStopMessage: finalStopMsg);

            return(Props.Create(() => new PersistenceSupervisor(childPropsFactory, childName, config,
                                                                strategy ?? Actor.SupervisorStrategy.StoppingStrategy)));
        }