explise opened a new issue, #3219:
URL: https://github.com/apache/iggy/issues/3219
### Description
## Summary
The Go SDK currently has no way for callers to observe client-level
lifecycle events (connection state changes, auth state changes). The Rust SDK
exposes these via `Client::subscribe_events()` returning a stream of
`DiagnosticEvent`. This issue ports that capability to the Go SDK.
## Motivation
The Go TCP client already has TODO stubs in place for event emission,
indicating this was anticipated:
- `foreign/go/client/tcp/tcp_core.go:399` — `// TODO publish event`
- `foreign/go/client/tcp/tcp_core.go:461` — `// TODO event pushing logic`
- `foreign/go/client/tcp/tcp_core.go:475` — `// TODO push shutdown event.
This is groundwork for adding a high-level `IggyConsumer` abstraction to the
Go SDK (planned as a follow-up). Diagnostic events let the consumer detect
disconnects, re-join consumer groups eagerly on reconnect, and resume cleanly.
Beyond the consumer use case, the events are also useful for application-level
observability (logging connection drops, exposing health metrics, etc.).
## Scope
In scope:
1. Add a `DiagnosticEvent` type in `foreign/go/contracts/` mirroring the
Rust enum (5 variants, with a `String()` method matching the `snake_case` form
used in Rust).
2. Add `SubscribeEvents() <-chan DiagnosticEvent` to the `Client` interface
in `foreign/go/contracts/client.go`.
3. Implement a small fan-out broadcaster in the TCP client so multiple
subscribers can each receive every event independently.
4. Wire emission into the TCP client:
- `Connected` — on initial connect and on every successful auto-reconnect
(existing reconnect loop at `foreign/go/client/tcp/tcp_core.go:86-100, 351-401`)
- `Disconnected` — at the existing TODO at `tcp_core.go:399`
- `Shutdown` — at the existing TODO at `tcp_core.go:475`
- `SignedIn` — after successful `LoginUser`
- `SignedOut` — after successful `LogoutUser`
5. Integration test that subscribes, exercises connect → disconnect →
reconnect → login → logout → close, and asserts the full event sequence is
delivered.
### Component
Go SDK
### Proposed solution
_No response_
### Alternatives considered
_No response_
--
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]