explise opened a new pull request, #4120:
URL: https://github.com/apache/iggy/pull/4120
## Which issue does this PR address
Closes #3219
## Status
Draft follow-up to #3621 (closed as stale). Reviving the same branch
`explise:feat/3219-go-diagnostic-events` to continue the work. It is
currently
far behind `master` and has not been rebased or re-verified yet, so CI is not
expected to pass until the fixes below are applied.
## Open review feedback still to address
- `HandleLeaderRedirection`: publish `DiagnosticEventRedirected` after
`disconnect()`, not before.
- Publish `Connected`/`Disconnected` before releasing `c.mtx`.
- `eventBroadcaster` cleanups: plain `ch <- event`, drop the `once.Do`, drop
the
closed-guard in `unsubscribe`, use `slices.Delete`, store by value.
- Integration test: do not `os.Exit(1)` without terminating the container.
- Reviewer asked for a BDD test covering event-subscription behavior.
## Rebase work required
- `master` split `state` into `transportState` + `sessionState` (#3652) and
removed/renamed the `newTestClient` test helper.
- Test package constants are now `rootUsername` / `rootPassword`, not
`defaultUsername` / `defaultPassword`.
## Rationale
The TCP client had `// TODO publish event` stubs at the connect/disconnect/
shutdown paths with no way for callers to observe connection or auth state
changes. This fills those in and is groundwork for a high-level
`IggyConsumer`
abstraction: diagnostic events let the consumer detect disconnects and
re-join
consumer groups eagerly on reconnect.
## What changed?
- `DiagnosticEvent` enum + `String()` in `contracts/`, and
`SubscribeEvents()`
on the `Client` interface.
- A small non-blocking broadcaster in the TCP client fanning out to multiple
independent subscribers.
- Emission wired into connect (`Connected`), disconnect/failed-connect
(`Disconnected`), shutdown (`Shutdown`), login (`SignedIn`) and logout
(`SignedOut`), plus redirection (`Redirected`).
## AI Usage
1. **Tool:** Claude Code.
2. **Scope:** Implementation of the enum, broadcaster, and event wiring;
rebase/conflict resolution onto latest `master`; test authoring.
3. **Verification:** Pending rebase; previously verified with local
`go build`/`go vet`/unit tests, `golangci-lint`, and integration tests.
4. **Can I explain every line?** Yes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]