If two services register only one is returned when issuing nats micro list
Closed this issue · 0 comments
mskitroot commented
Observed behavior
In the below example, both services are registered. When requesting to list the services through nats micro list
only one is returned.
The issue seems to be in https://github.com/nats-io/nats.net.v2/blob/main/src/NATS.Client.Services/Internal/SvcListener.cs which subscribes to answer to $[SRV.INFO] but on the same QueueGroup since one is not provided during AddEndpointAsync.
The same issue exists even if a different connection is used within the same project or services are started from different projects.
var svc = new NatsSvcContext(_nats);
var calcService = await svc.AddServiceAsync("calc", "1.0.0");
var math = await calcService.AddGroupAsync("math");
await math.AddEndpointAsync<MathReq>(name: "add", handler: async m =>
{
var (a, b) = m.Data!;
await m.ReplyAsync(new MathResp(a + b));
});
await math.AddEndpointAsync<MathReq>(name: "sub", handler: async m =>
{
var (a, b) = m.Data!;
await m.ReplyAsync<MathResp>(new MathResp(a - b));
});
var pluginService = await svc.AddServiceAsync("plugin", "1.0.0");
var plugin = await pluginService.AddGroupAsync("plugin");
await plugin.AddEndpointAsync<string>(name: "new", handler: async m =>
{
await m.ReplyAsync("new " + m.Data);
});
await plugin.AddEndpointAsync<string>(name: "run", handler: async m =>
{
await m.ReplyAsync("run " + m.Data);
});
Expected behavior
Both services should be returned.
Server and client version
Server: Version: 2.10.5
Client: Nats.Client: 2.0.2
Host environment
No response
Steps to reproduce
No response