feat: add route propagation and bootstrap js gateway leaf services
This commit is contained in:
11
src/NATS.Server/LeafNodes/LeafConnection.cs
Normal file
11
src/NATS.Server/LeafNodes/LeafConnection.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace NATS.Server.LeafNodes;
|
||||
|
||||
public sealed class LeafConnection
|
||||
{
|
||||
public string RemoteEndpoint { get; }
|
||||
|
||||
public LeafConnection(string remoteEndpoint)
|
||||
{
|
||||
RemoteEndpoint = remoteEndpoint;
|
||||
}
|
||||
}
|
||||
31
src/NATS.Server/LeafNodes/LeafNodeManager.cs
Normal file
31
src/NATS.Server/LeafNodes/LeafNodeManager.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NATS.Server.Configuration;
|
||||
|
||||
namespace NATS.Server.LeafNodes;
|
||||
|
||||
public sealed class LeafNodeManager : IAsyncDisposable
|
||||
{
|
||||
private readonly LeafNodeOptions _options;
|
||||
private readonly ServerStats _stats;
|
||||
private readonly ILogger<LeafNodeManager> _logger;
|
||||
|
||||
public LeafNodeManager(LeafNodeOptions options, ServerStats stats, ILogger<LeafNodeManager> logger)
|
||||
{
|
||||
_options = options;
|
||||
_stats = stats;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public Task StartAsync(CancellationToken ct)
|
||||
{
|
||||
_logger.LogDebug("Leaf manager started (listen={Host}:{Port})", _options.Host, _options.Port);
|
||||
Interlocked.Exchange(ref _stats.Leafs, 0);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public ValueTask DisposeAsync()
|
||||
{
|
||||
_logger.LogDebug("Leaf manager stopped");
|
||||
return ValueTask.CompletedTask;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user