Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't work reconnect #199

Open
HrenuS opened this issue May 31, 2021 · 0 comments
Open

Don't work reconnect #199

HrenuS opened this issue May 31, 2021 · 0 comments

Comments

@HrenuS
Copy link

HrenuS commented May 31, 2021

private IConnection CreateNatsConnection()
        {
            var natsOptions = ConnectionFactory.GetDefaultOptions();
            natsOptions.AllowReconnect = true;
            natsOptions.MaxReconnect = Options.ReconnectForever;
            natsOptions.Url = _stanConfig.Url;
            return new ConnectionFactory().CreateConnection(natsOptions);
        }
        
public Task CreateStanConnection()
        {
            var options = StanOptions.GetDefaultOptions();
            options.PubAckWait = _stanConfig.PubAckWait;
            options.NatsConn = CreateNatsConnection();
            var clientId = Guid.NewGuid().ToString();
            _connection =
                _stanConnectionFactory.CreateConnection(_stanConfig.ClusterId, clientId, options);
            return Task.CompletedTask;
        }        

I have case:

  1. create connection
  2. publish...
  3. disable ethernet
  4. publish
  5. enable ethernet
  6. publish

NatsConnection always after enable ethernet is NULL.

image

@HrenuS HrenuS changed the title Dont work reconnect Don't work reconnect May 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant