mirror of
https://github.com/zitadel/zitadel.git
synced 2025-10-23 19:49:21 +00:00
feat: pub sub (#1341)
* fix: pub sub * fix: adaot config to commands (and queries) * remove dependency on vv2 in v1 * fix: pub sub in new eventstore * fix tests Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
@@ -37,18 +37,16 @@ func (es *eventstore) Subscribe(aggregates ...models.AggregateType) *Subscriptio
|
||||
return sub
|
||||
}
|
||||
|
||||
func notify(aggregates []*models.Aggregate) {
|
||||
func Notify(events []*models.Event) {
|
||||
subsMutext.Lock()
|
||||
defer subsMutext.Unlock()
|
||||
for _, aggregate := range aggregates {
|
||||
subs, ok := subscriptions[aggregate.Type()]
|
||||
for _, event := range events {
|
||||
subs, ok := subscriptions[event.AggregateType]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
for _, sub := range subs {
|
||||
for _, event := range aggregate.Events {
|
||||
sub.Events <- event
|
||||
}
|
||||
sub.Events <- event
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user