Show / Hide Table of Contents

Class ApplicationMaintenanceInterfaceHost

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

Inheritance
object
BackgroundService
ApplicationMaintenanceInterfaceHost
CommandLineMaintenanceInterfaceHost
Implements
IHostedService
IDisposable
Inherited Members
BackgroundService.StartAsync(CancellationToken)
BackgroundService.StopAsync(CancellationToken)
BackgroundService.Dispose()
BackgroundService.ExecuteTask
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DotNext.Maintenance
Assembly: DotNext.MaintenanceServices.dll
Syntax
public abstract class ApplicationMaintenanceInterfaceHost : BackgroundService, IHostedService, IDisposable
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

| Edit this page 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

| Edit this page 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
| Edit this page View Source

BufferSize

Gets or sets the internal buffer size.

Declaration
public int BufferSize { get; init; }
Property Value
Type Description
int
| Edit this page 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>
| Edit this page 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>
| Edit this page View Source

Logger

Gets the logger associated with this host.

Declaration
protected ILogger Logger { get; }
Property Value
Type Description
ILogger
| Edit this page 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

| Edit this page View Source

ExecuteAsync(CancellationToken)

Starts listening for commands to be received through Unix Domain Socket.

Declaration
protected override sealed Task ExecuteAsync(CancellationToken token)
Parameters
Type Name Description
CancellationToken token

The token associated with the lifetime of this host.

Returns
Type Description
Task

The task representing command processing loop.

Overrides
BackgroundService.ExecuteAsync(CancellationToken)
| Edit this page 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.

Implements

IHostedService
IDisposable

Extension Methods

BasicExtensions.As<T>(T)
BasicExtensions.GetUserData<T>(T)
BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, ReadOnlySpan<T>)
ExpressionBuilder.Const<T>(T)
AsyncLockAcquisition.AcquireLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, TimeSpan, CancellationToken)
LockAcquisition.AcquireReadLock<T>(T)
LockAcquisition.AcquireReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireUpgradeableReadLock<T>(T)
LockAcquisition.AcquireUpgradeableReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireWriteLock<T>(T)
LockAcquisition.AcquireWriteLock<T>(T, TimeSpan)
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾