Axon Docs
GitHub Quickstart

Docs / API Reference

Axon.Client

GoAxon.Client — enqueue jobs, schedule recurring jobs, and execute jobs dispatched to this process.

AddAxonClient

Extension method
void AddAxonClient(this IServiceCollection services, string baseUrl)

Registers IAxonClient and opens a persistent SignalR connection to {baseUrl}/hubs/axon, with automatic reconnect. Call once in startup.

  • baseUrl string — where Axon.Server is hosted, e.g. "https://localhost:7221". Trailing slashes are trimmed automatically.

IAxonClient

Interface
Task<string> EnqueueAsync(Expression<Action> methodCall, AxonEnqueueOptions? options = null)

Enqueues methodCall to run as soon as a connected device picks it up. Returns the new job's id once the server has durably stored it — awaiting this does not wait for the job to actually run. A generic overload, EnqueueAsync<TType>, targets a method on a specific type.

Interface
Task<string> ScheduleAsync(TimeSpan delay, Expression<Action> methodCall, AxonEnqueueOptions? options = null)

Like EnqueueAsync, but the job only becomes eligible for dispatch after delay has elapsed. An overload taking DateTimeOffset scheduledFor schedules for an absolute time instead. Both have generic <TType> variants.

Interface
Task<string> ContinueWithAsync(string parentJobId, Expression<Action> methodCall, bool continueOnParentFailure = false, AxonEnqueueOptions? options = null)

Enqueues a job that only runs after parentJobId reaches a terminal state: promoted on the parent's success, or on the parent's failure only if continueOnParentFailure is true (default false — the continuation is left permanently unscheduled if the parent fails).

Interface
Task AddOrUpdateRecurringAsync(string recurringJobId, string cronExpression, Expression<Action> methodCall, CancellationToken cancellationToken = default)

Creates or updates a recurring job on a cron schedule. A matching RemoveRecurringAsync(string recurringJobId, ...) deletes it.

Every overload takes a strongly-typed expression tree, not a string method name — the compiler checks the call. Arguments are captured and JSON-serialized; the method's declaring type is never loaded by Axon.Server, only referenced by name.