Search Results for

    Show / Hide Table of Contents

    Interface ITimerScheduler

    Support for scheduled "Self" messages in an actor.

    Timers are bound to the lifecycle of the actor that owns it, and thus are cancelled automatically when it is restarted or stopped.

    ITimerScheduler is not thread-safe, i.e.it must only be used within the actor that owns it.

    Namespace: Akka.Actor
    Assembly: Akka.dll
    Syntax
    public interface ITimerScheduler

    Properties

    | Edit this page View Source

    ActiveTimers

    Retrieves all current active timer keys

    Declaration
    IReadOnlyCollection<object> ActiveTimers { get; }
    Property Value
    Type Description
    IReadOnlyCollection<object>

    Methods

    | Edit this page View Source

    Cancel(object)

    Cancel a timer with a given key. If canceling a timer that was already canceled, or key never was used to start a timer this operation will do nothing.

    It is guaranteed that a message from a canceled timer, including its previous incarnation for the same key, will not be received by the actor, even though the message might already be enqueued in the mailbox when cancel is called.

    Declaration
    void Cancel(object key)
    Parameters
    Type Name Description
    object key

    Name of timer

    | Edit this page View Source

    CancelAll()

    Cancel all timers.

    Declaration
    void CancelAll()
    | Edit this page View Source

    IsTimerActive(object)

    Check if a timer with a given key is active.

    Declaration
    bool IsTimerActive(object key)
    Parameters
    Type Name Description
    object key
    Returns
    Type Description
    bool

    Name of timer

    | Edit this page View Source

    StartPeriodicTimer(object, object, TimeSpan)

    Start a periodic timer that will send msg to the "Self" actor at a fixed interval.

    Each timer has a key and if a new timer with same key is started the previous is cancelled and it's guaranteed that a message from the previous timer is not received, even though it might already be enqueued in the mailbox when the new timer is started.

    Declaration
    void StartPeriodicTimer(object key, object msg, TimeSpan interval)
    Parameters
    Type Name Description
    object key

    Name of timer

    object msg

    Message to schedule

    TimeSpan interval

    Interval

    | Edit this page View Source

    StartPeriodicTimer(object, object, TimeSpan, IActorRef)

    Start a periodic timer that will send msg to the "Self" actor at a fixed interval.

    Each timer has a key and if a new timer with same key is started the previous is cancelled and it's guaranteed that a message from the previous timer is not received, even though it might already be enqueued in the mailbox when the new timer is started.

    Declaration
    void StartPeriodicTimer(object key, object msg, TimeSpan interval, IActorRef sender)
    Parameters
    Type Name Description
    object key

    Name of timer

    object msg

    Message to schedule

    TimeSpan interval

    Interval

    IActorRef sender

    The sender override for the timer message

    | Edit this page View Source

    StartPeriodicTimer(object, object, TimeSpan, TimeSpan)

    Start a periodic timer that will send msg to the "Self" actor at a fixed interval.

    Each timer has a key and if a new timer with same key is started the previous is cancelled and it's guaranteed that a message from the previous timer is not received, even though it might already be enqueued in the mailbox when the new timer is started.

    Declaration
    void StartPeriodicTimer(object key, object msg, TimeSpan initialDelay, TimeSpan interval)
    Parameters
    Type Name Description
    object key

    Name of timer

    object msg

    Message to schedule

    TimeSpan initialDelay

    Initial delay

    TimeSpan interval

    Interval

    | Edit this page View Source

    StartPeriodicTimer(object, object, TimeSpan, TimeSpan, IActorRef)

    Start a periodic timer that will send msg to the "Self" actor at a fixed interval.

    Each timer has a key and if a new timer with same key is started the previous is cancelled and it's guaranteed that a message from the previous timer is not received, even though it might already be enqueued in the mailbox when the new timer is started.

    Declaration
    void StartPeriodicTimer(object key, object msg, TimeSpan initialDelay, TimeSpan interval, IActorRef sender)
    Parameters
    Type Name Description
    object key

    Name of timer

    object msg

    Message to schedule

    TimeSpan initialDelay

    Initial delay

    TimeSpan interval

    Interval

    IActorRef sender

    The sender override for the timer message

    | Edit this page View Source

    StartSingleTimer(object, object, TimeSpan)

    Start a timer that will send msg once to the "Self" actor after the given timeout.

    Each timer has a key and if a new timer with same key is started the previous is cancelled and it's guaranteed that a message from the previous timer is not received, even though it might already be enqueued in the mailbox when the new timer is started.

    Declaration
    void StartSingleTimer(object key, object msg, TimeSpan timeout)
    Parameters
    Type Name Description
    object key

    Name of timer

    object msg

    Message to schedule

    TimeSpan timeout

    Interval

    | Edit this page View Source

    StartSingleTimer(object, object, TimeSpan, IActorRef)

    Start a timer that will send msg once to the "Self" actor after the given timeout.

    Each timer has a key and if a new timer with same key is started the previous is cancelled and it's guaranteed that a message from the previous timer is not received, even though it might already be enqueued in the mailbox when the new timer is started.

    Declaration
    void StartSingleTimer(object key, object msg, TimeSpan timeout, IActorRef sender)
    Parameters
    Type Name Description
    object key

    Name of timer

    object msg

    Message to schedule

    TimeSpan timeout

    Interval

    IActorRef sender

    The sender override for the timer message

    Extension Methods

    ObjectExtensions.IsDefaultForType<T>(T)
    ObjectExtensions.AsOption<T>(T)
    Extensions.AsInstanceOf<T>(object)
    In this article
    • githubEdit this page
    • View Source
    Back to top
    Contribute
    • Project Chat
    • Discussion Forum
    • Source Code
    Support
    • Akka.NET Support Plans
    • Akka.NET Observability Tools
    • Akka.NET Training & Consulting
    Maintained By
    • Petabridge - The Akka.NET Company
    • Learn Akka.NET