feat(events): migrate game-creation and bot flows to Redis Streams NCS-89 #62

Merged
Janis merged 3 commits from feat/NCS-89-redis-eventbus-streams into main 2026-06-09 10:31:32 +02:00
Member

Replace synchronous account→core game-creation HTTP call and plain
pub/sub bot game-start events with Redis Streams using consumer groups,
XACK, retry, and a Dead Letter Queue for at-least-once delivery and
observability.

  • account: GameCreationStreamClient publishes game-creation requests and
    correlates responses via a per-instance consumer group (NCS-91)
  • core: GameCreationStreamListener consumes requests, calls
    GameCreationService, publishes response events, retries, and routes
    exhausted/unparseable events to the DLQ (NCS-91, NCS-93, NCS-94)
  • official-bots: bot game-start events migrated from pub/sub to Streams
    with consumer group, XACK, retry, and DLQ (NCS-92)
  • account EventPublisher dual-writes to the stream and legacy pub/sub
    channel for backward compatibility
  • all flows use the typed EventEnvelope (eventId/type/payload/timestamp/
    correlationId) with DLQ error context (eventType, error, attempt)
  • register new DTOs and EventEnvelope/EventType for native reflection

Closes NCS-91, NCS-92, NCS-93, NCS-94

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

Replace synchronous account→core game-creation HTTP call and plain pub/sub bot game-start events with Redis Streams using consumer groups, XACK, retry, and a Dead Letter Queue for at-least-once delivery and observability. - account: GameCreationStreamClient publishes game-creation requests and correlates responses via a per-instance consumer group (NCS-91) - core: GameCreationStreamListener consumes requests, calls GameCreationService, publishes response events, retries, and routes exhausted/unparseable events to the DLQ (NCS-91, NCS-93, NCS-94) - official-bots: bot game-start events migrated from pub/sub to Streams with consumer group, XACK, retry, and DLQ (NCS-92) - account EventPublisher dual-writes to the stream and legacy pub/sub channel for backward compatibility - all flows use the typed EventEnvelope (eventId/type/payload/timestamp/ correlationId) with DLQ error context (eventType, error, attempt) - register new DTOs and EventEnvelope/EventType for native reflection Closes NCS-91, NCS-92, NCS-93, NCS-94 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Janis added 1 commit 2026-06-06 17:37:08 +02:00
feat(events): migrate game-creation and bot flows to Redis Streams
Build & Test (NowChessSystems) TeamCity build failed
e7a49a2f3e
Replace synchronous account→core game-creation HTTP call and plain
pub/sub bot game-start events with Redis Streams using consumer groups,
XACK, retry, and a Dead Letter Queue for at-least-once delivery and
observability.

- account: GameCreationStreamClient publishes game-creation requests and
  correlates responses via a per-instance consumer group (NCS-91)
- core: GameCreationStreamListener consumes requests, calls
  GameCreationService, publishes response events, retries, and routes
  exhausted/unparseable events to the DLQ (NCS-91, NCS-93, NCS-94)
- official-bots: bot game-start events migrated from pub/sub to Streams
  with consumer group, XACK, retry, and DLQ (NCS-92)
- account EventPublisher dual-writes to the stream and legacy pub/sub
  channel for backward compatibility
- all flows use the typed EventEnvelope (eventId/type/payload/timestamp/
  correlationId) with DLQ error context (eventType, error, attempt)
- register new DTOs and EventEnvelope/EventType for native reflection

Closes NCS-91, NCS-92, NCS-93, NCS-94

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Janis changed title from feat(events): migrate game-creation and bot flows to Redis Streams to feat(events): migrate game-creation and bot flows to Redis Streams NCS-89 2026-06-06 17:38:15 +02:00
Janis added 1 commit 2026-06-06 19:15:20 +02:00
fix(events): suppress stream poll loop in test profile
Build & Test (NowChessSystems) TeamCity build failed
5f35318ebd
CDI fires StartupEvent to all observer beans regardless of @InjectMock
substitution, causing GameCreationStreamClient and GameCreationStreamListener
to start their poll loops during @QuarkusTest even when mocked. Without
Redis configured in account tests, this floods logs with NPE stack traces
from the unconfigured RedisDataSource synthetic bean.

- Switch @Startup/@PostConstruct to @Observes StartupEvent on both beans
- Guard startup body with nowchess.game-creation-stream.enabled (default true)
- Disable the flag in modules/account/src/test/resources/application.yml

Mirrors the nowchess.coordinator.enabled pattern in InstanceHeartbeatService.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Janis added 1 commit 2026-06-06 20:24:48 +02:00
GameCreationServiceTest called createGame which routes through
RedisGameRegistry.store → IoGrpcClientWrapper.exportCombined, hitting a
real gRPC stub that fails with UNIMPLEMENTED in tests.

MockRedisDataSourceProducer's RETURNS_DEEP_STUBS mock caused a classloader
mismatch when GameCreationStreamListener called .stream() on it
(PubSubCommands mock returned instead of StreamCommands).

- Add @InjectMock IoGrpcClientWrapper + @BeforeEach stub in GameCreationServiceTest
- Add nowchess.game-creation-stream.enabled: false to core test application.yml

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Janis merged commit a24924c230 into main 2026-06-09 10:31:32 +02:00
Janis deleted branch feat/NCS-89-redis-eventbus-streams 2026-06-09 10:31:32 +02:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NowChess/NowChessSystems#62