Show / Hide Table of Contents

Class ApplicationMaintenanceInterfaceHost

Represents host of Application Maintenance Interface (AMI). The host provides IPC using Unix Domain Socket.

Inheritance
object
Disposable
ApplicationMaintenanceInterfaceHost
CommandLineMaintenanceInterfaceHost
Implements
IDisposable
IHostedService
Inherited Members
Disposable.CreateException()
Disposable.GetDisposedTask<T>()
Disposable.TrySetDisposedException<T>(TaskCompletionSource<T>)
Disposable.TrySetDisposedException(TaskCompletionSource)
Disposable.DisposeAsyncCore()
Disposable.DisposeAsync()
Disposable.TryBeginDispose()
Disposable.Dispose()
Disposable.Dispose(IEnumerable<IDisposable>)
Disposable.DisposeAsync(params IEnumerable<IAsyncDisposable>)
Disposable.Dispose<TDisposable>(params ReadOnlySpan<TDisposable>)
Disposable.IsDisposed
Disposable.IsDisposing
Disposable.IsDisposingOrDisposed
Disposable.DisposedTask
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: DotNext.Maintenance
Assembly: DotNext.MaintenanceServices.dll
Syntax
public abstract class ApplicationMaintenanceInterfaceHost : Disposable, IDisposable, IHostedService
Remarks

AMI (Application Maintenance Interface) allows to interact with running application or microservice through Unix Domain Socket. The administrator can use command-line tools such as netcat to send commands to the applications. These commands may trigger GC, clear application cache, force reconnection to DB or any other maintenance actions.

Constructors

View Source

ApplicationMaintenanceInterfaceHost(UnixDomainSocketEndPoint, ILoggerFactory?)

Initializes a new host.

Declaration
protected ApplicationMaintenanceInterfaceHost(UnixDomainSocketEndPoint endPoint, ILoggerFactory? loggerFactory)
Parameters
Type Name Description
UnixDomainSocketEndPoint endPoint

Unix Domain Socket address used as a interaction point.

ILoggerFactory loggerFactory

The logger factory.

Exceptions
Type Condition
ArgumentNullException

endPoint is null.

Properties

View Source

Backlog

Gets or sets the maximum length of the pending connections queue.

Declaration
public int Backlog { get; init; }
Property Value
Type Description
int
View Source

BufferSize

Gets or sets the internal buffer size.

Declaration
public int BufferSize { get; init; }
Property Value
Type Description
int
View Source

ByteBufferAllocator

Gets or sets allocator for the buffer of bytes.

Declaration
public MemoryAllocator<byte> ByteBufferAllocator { get; init; }
Property Value
Type Description
MemoryAllocator<byte>
View Source

CharBufferAllocator

Gets or sets allocator for the buffer of characters.

Declaration
public MemoryAllocator<char> CharBufferAllocator { get; init; }
Property Value
Type Description
MemoryAllocator<char>
View Source

Logger

Gets the logger associated with this host.

Declaration
protected ILogger Logger { get; }
Property Value
Type Description
ILogger
View Source

TextEncoding

Gets or sets encoding of the command text and responses.

Declaration
public Encoding TextEncoding { get; init; }
Property Value
Type Description
Encoding

Methods

View Source

Dispose(bool)

Releases managed and unmanaged resources associated with this object.

Declaration
protected override void Dispose(bool disposing)
Parameters
Type Name Description
bool disposing

true if called from Dispose(); false if called from finalizer ~Disposable().

Overrides
Disposable.Dispose(bool)
View Source

ExecuteCommandAsync(IMaintenanceSession, ReadOnlyMemory<char>, CancellationToken)

Executes command asynchronously.

Declaration
protected abstract ValueTask ExecuteCommandAsync(IMaintenanceSession session, ReadOnlyMemory<char> command, CancellationToken token)
Parameters
Type Name Description
IMaintenanceSession session

Command session.

ReadOnlyMemory<char> command

The command to execute.

CancellationToken token

The token that is associated with the host lifetime.

Returns
Type Description
ValueTask

A task representing asynchronous execution of the command.

View Source

StartAsync(CancellationToken)

Triggered when the application host is ready to start the service.

Declaration
public Task StartAsync(CancellationToken token)
Parameters
Type Name Description
CancellationToken token
Returns
Type Description
Task

A Task that represents the asynchronous Start operation.

View Source

StopAsync(CancellationToken)

Triggered when the application host is performing a graceful shutdown.

Declaration
public Task StopAsync(CancellationToken token)
Parameters
Type Name Description
CancellationToken token
Returns
Type Description
Task

A Task that represents the asynchronous Stop operation.

Implements

IDisposable
IHostedService

Extension Methods

BasicExtensions.As<T>(T)
BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, params ReadOnlySpan<T>)
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾