Skip to content

Implement Lame Duck Mode Event Handler#716

Merged
mtmk merged 6 commits into
nats-io:mainfrom
pzajaczkowski:ldm-event-handler
Jan 21, 2025
Merged

Implement Lame Duck Mode Event Handler#716
mtmk merged 6 commits into
nats-io:mainfrom
pzajaczkowski:ldm-event-handler

Conversation

@pzajaczkowski

@pzajaczkowski pzajaczkowski commented Jan 15, 2025

Copy link
Copy Markdown
Contributor

Resolves #23

I had two ideas for approaching this issue:

  • Make WritableServerInfo property and add setter, that will check if LDM has changed to true
  • Add a trigger method that writes the event to a channel in NatsConnection and invoke it directly from NatsReadProtocolProcessor after recieving INFO from server with LDM.

I decided to go with first option.

There is one thing i am not sure of: should anything be passed as argument to the LameDuckModeActivated event? Currently, it is an empty string.

Comment thread src/NATS.Client.Core/NatsConnection.cs Outdated
@mtmk

mtmk commented Jan 16, 2025

Copy link
Copy Markdown
Member

@pzajaczkowski thanks for the PR. long overdue that issue ;)

  • Make WritableServerInfo property and add setter, that will check if LDM has changed to true
  • Add a trigger method that writes the event to a channel in NatsConnection and invoke it directly from NatsReadProtocolProcessor after recieving INFO from server with LDM.

I decided to go with first option.

I think that's fine.

There is one thing i am not sure of: should anything be passed as argument to the LameDuckModeActivated event? Currently, it is an empty string.

Potentially passing the host might be a interesting. Or a copy of the server info?

EDIT: What do you think about passing Uri of the host similar to the proposal in PR #712

Comment thread tests/NATS.Client.Core.Tests/NatsConnectionTest.cs Outdated
Comment thread src/NATS.Client.Core/NatsConnection.cs Outdated
Comment thread tests/NATS.Client.Core.Tests/NatsConnectionTest.cs Outdated
pzajaczkowski and others added 2 commits January 21, 2025 15:45
The LDM request feature test uses added to server version 2.10.

@mtmk mtmk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks @pzajaczkowski

@mtmk
mtmk merged commit b254e4c into nats-io:main Jan 21, 2025
@pzajaczkowski
pzajaczkowski deleted the ldm-event-handler branch January 22, 2025 13:24
mtmk added a commit that referenced this pull request Jan 27, 2025
* Fix telemetry header readonly error (#719)
* Add NatsClient to DI (#689)
* Add callback to NatsAuthOpts that allows refreshing a Token (#712)
* Implement Lame Duck Mode Event Handler (#716)
* Add CreateOrUpdateStoreAsync (#707)
@mtmk mtmk mentioned this pull request Jan 27, 2025
mtmk added a commit that referenced this pull request Jan 27, 2025
* Fix telemetry header readonly error (#719)
* Add NatsClient to DI (#689)
* Add callback to NatsAuthOpts that allows refreshing a Token (#712)
* Implement Lame Duck Mode Event Handler (#716)
* Add CreateOrUpdateStoreAsync (#707)
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

Successfully merging this pull request may close these issues.

Implement Lame Duck Mode Event Handler

4 participants