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 : 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 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
| Edit this page 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
| Edit this page View SourceExecuteAsync(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
| Edit this page 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. |