Added support for running callbacks after registration, ping and deregistration#27
Merged
orpiske merged 1 commit intowanaku-ai:mainfrom Nov 20, 2025
Merged
Conversation
Reviewer's GuideThis PR refactors the ZeroDepRegistrationManager to support callback hooks for registration lifecycle events by introducing a callback registry, replacing inline logging with callback invocations, and providing a default logging callback implementation. Sequence diagram for registration event with callback invocationsequenceDiagram
participant Manager as ZeroDepRegistrationManager
participant Callback as RegistrationCallback
participant Target as ServiceTarget
Manager->>Target: Attempt registration
Manager->>Callback: onRegistration(manager, target)
Sequence diagram for ping event with callback invocationsequenceDiagram
participant Manager as ZeroDepRegistrationManager
participant Callback as RegistrationCallback
participant Target as ServiceTarget
Manager->>Target: Ping router
Manager->>Callback: onPing(manager, target, status)
Sequence diagram for deregistration event with callback invocationsequenceDiagram
participant Manager as ZeroDepRegistrationManager
participant Callback as RegistrationCallback
participant Target as ServiceTarget
Manager->>Target: Deregister service
Manager->>Callback: onDeregistration(manager, target, status)
Class diagram for updated registration lifecycle with callbacksclassDiagram
class ZeroDepRegistrationManager {
-boolean registered
-ScheduledExecutorService scheduler
-ScheduledFuture registrationTask
-List~RegistrationCallback~ callbacks
+ZeroDepRegistrationManager(DiscoveryServiceHttpClient, ServiceTarget, InstanceDataManager)
+addCallBack(RegistrationCallback)
-runCallBack(Consumer~RegistrationCallback~)
}
class RegistrationCallback {
<<interface>>
+onPing(RegistrationManager, ServiceTarget, int)
+onRegistration(RegistrationManager, ServiceTarget)
+onDeregistration(RegistrationManager, ServiceTarget, int)
}
class RegistrationLogCallback {
+onPing(RegistrationManager, ServiceTarget, int)
+onRegistration(RegistrationManager, ServiceTarget)
+onDeregistration(RegistrationManager, ServiceTarget, int)
}
ZeroDepRegistrationManager --> "*" RegistrationCallback : uses
RegistrationLogCallback ..|> RegistrationCallback : implements
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey there - I've reviewed your changes - here's some feedback:
- There’s an extra '}' in the non-debug branch of runCallBack’s LOG.warn format string, which will break the placeholder—please correct the formatting.
- Method names runCallBack and addCallBack don’t follow consistent camelCase conventions; consider renaming them to runCallback and addCallback for clarity.
- Automatically registering a default RegistrationLogCallback in the constructor may not be desired for all clients—consider making it injectable or optional to give users control over logging.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- There’s an extra '}' in the non-debug branch of runCallBack’s LOG.warn format string, which will break the placeholder—please correct the formatting.
- Method names runCallBack and addCallBack don’t follow consistent camelCase conventions; consider renaming them to runCallback and addCallback for clarity.
- Automatically registering a default RegistrationLogCallback in the constructor may not be desired for all clients—consider making it injectable or optional to give users control over logging.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Added support for running callbacks after registration, ping and deregistration Ref: wanaku-ai/wanaku#637
2bd9990 to
77d87f5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ref: wanaku-ai/wanaku#637
Summary by Sourcery
Enable extensible post-event handling in ZeroDepRegistrationManager by adding a callback registry, exposing an addCallBack method, and providing a default log callback implementation
New Features:
Enhancements: