NATSEventBus exists but is not integrated with JetStreamEventStore. Events don't flow across cluster nodes.
Current State
JetStreamEventStore has broadcaster field but most code uses NewJetStreamEventStore (no broadcaster)
NewJetStreamEventStoreWithBroadcaster exists but underused
NATSEventBus can receive events but not subscribed by default
Required Implementation
1. Default Broadcaster Configuration
// Create NATS event busnatsBus,_:=aether.NewNATSEventBus(natsConn)// Create event store with broadcasterstore,_:=store.NewJetStreamEventStoreWithBroadcaster(natsConn,"events",natsBus,"tenant-abc")
2. Subscribe to EventStored Events
eventStoredCh:=natsBus.SubscribeWithFilter("tenant-abc",&aether.SubscriptionFilter{EventTypes:[]string{aether.EventTypeEventStored},},)// Update version cache when events are persistedgofunc(){forev:=rangeeventStoredCh{store.UpdateVersionCache(ev.Data["actorId"],ev.Version)}}()
3. Cross-Node Event Flow
Node A: SaveEvent -> JetStream stream
EventStore: Publish EventStored to NATSEventBus
NATSEventBus: Publish to NATS "aether.events.tenant-abc"
Node B: Receive via NATS subscription
Node B: Deliver to local subscribers
Acceptance Criteria
NATSEventBus + JetStreamEventStore integration example
Events published to NATS when using broadcaster
Events received from other nodes via NATS
Namespace isolation maintained across nodes
Integration test with multiple NATS nodes
## Problem
NATSEventBus exists but is not integrated with JetStreamEventStore. Events don't flow across cluster nodes.
## Current State
- `JetStreamEventStore` has broadcaster field but most code uses `NewJetStreamEventStore` (no broadcaster)
- `NewJetStreamEventStoreWithBroadcaster` exists but underused
- NATSEventBus can receive events but not subscribed by default
## Required Implementation
### 1. Default Broadcaster Configuration
```go
// Create NATS event bus
natsBus, _ := aether.NewNATSEventBus(natsConn)
// Create event store with broadcaster
store, _ := store.NewJetStreamEventStoreWithBroadcaster(
natsConn, "events", natsBus, "tenant-abc"
)
```
### 2. Subscribe to EventStored Events
```go
eventStoredCh := natsBus.SubscribeWithFilter(
"tenant-abc",
&aether.SubscriptionFilter{
EventTypes: []string{aether.EventTypeEventStored},
},
)
// Update version cache when events are persisted
go func() {
for ev := range eventStoredCh {
store.UpdateVersionCache(ev.Data["actorId"], ev.Version)
}
}()
```
### 3. Cross-Node Event Flow
1. Node A: SaveEvent -> JetStream stream
2. EventStore: Publish EventStored to NATSEventBus
3. NATSEventBus: Publish to NATS "aether.events.tenant-abc"
4. Node B: Receive via NATS subscription
5. Node B: Deliver to local subscribers
## Acceptance Criteria
- [ ] NATSEventBus + JetStreamEventStore integration example
- [ ] Events published to NATS when using broadcaster
- [ ] Events received from other nodes via NATS
- [ ] Namespace isolation maintained across nodes
- [ ] Integration test with multiple NATS nodes
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Problem
NATSEventBus exists but is not integrated with JetStreamEventStore. Events don't flow across cluster nodes.
Current State
JetStreamEventStorehas broadcaster field but most code usesNewJetStreamEventStore(no broadcaster)NewJetStreamEventStoreWithBroadcasterexists but underusedRequired Implementation
1. Default Broadcaster Configuration
2. Subscribe to EventStored Events
3. Cross-Node Event Flow
Acceptance Criteria
Implementation complete! Created PR #151 with:
UpdateVersionCachemethod in JetStreamEventStoreSubscribeToEventStoredhelper in NATSEventBus