Class ApplicationMaintenanceInterfaceHost
Represents host of Application Maintenance Interface (AMI). The host provides IPC using Unix Domain Socket.
Inheritance
Inherited Members
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 SourceApplicationMaintenanceInterfaceHost(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 |
|
Properties
View SourceBacklog
Gets or sets the maximum length of the pending connections queue.
Declaration
public int Backlog { get; init; }
Property Value
| Type | Description |
|---|---|
| int |
BufferSize
Gets or sets the internal buffer size.
Declaration
public int BufferSize { get; init; }
Property Value
| Type | Description |
|---|---|
| int |
ByteBufferAllocator
Gets or sets allocator for the buffer of bytes.
Declaration
public MemoryAllocator<byte> ByteBufferAllocator { get; init; }
Property Value
| Type | Description |
|---|---|
| MemoryAllocator<byte> |
CharBufferAllocator
Gets or sets allocator for the buffer of characters.
Declaration
public MemoryAllocator<char> CharBufferAllocator { get; init; }
Property Value
| Type | Description |
|---|---|
| MemoryAllocator<char> |
Logger
Gets the logger associated with this host.
Declaration
protected ILogger Logger { get; }
Property Value
| Type | Description |
|---|---|
| ILogger |
TextEncoding
Gets or sets encoding of the command text and responses.
Declaration
public Encoding TextEncoding { get; init; }
Property Value
| Type | Description |
|---|---|
| Encoding |
Methods
View SourceDispose(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
View SourceExecuteCommandAsync(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. |
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. |
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. |