Subscriptions: bi-di index on per subscription#7770
Conversation
cicoyle
left a comment
There was a problem hiding this comment.
Few comments from me, but generally looks good 👍🏻
| Resiliency: resiliency.New(nil), | ||
| }), | ||
| pubsubAdapter: &daprt.MockPubSubAdapter{}, | ||
| outbox: outboxfake.New(), |
There was a problem hiding this comment.
This is a nit, but upon looking at our naming convention in dapr, I see fake<x>. Can this be renamed to fakeoutbox? or mockoutbox?
There was a problem hiding this comment.
I think this is more correct the name follows the package hierarchy outboxfake "github.com/dapr/dapr/pkg/outbox/fake"
| } | ||
|
|
||
| func (c *ComponentStore) ListDeclarativeSubscriptions() []subapi.Subscription { | ||
| func (c *ComponentStore) ListSubscriptionsAppByPubSub(name string) []*NamedSubscription { |
There was a problem hiding this comment.
| func (c *ComponentStore) ListSubscriptionsAppByPubSub(name string) []*NamedSubscription { | |
| func (c *ComponentStore) ListPubSubSubscriptions(name string) []*NamedSubscription { |
There was a problem hiding this comment.
I like this name as it is more explicit- We are listing subscriptions, which are either programmatic or declarative (i.e. app callback based), which are subscribed to the given pubsub name.
| } | ||
|
|
||
| func (c *ComponentStore) GetDeclarativeSubscription(name string) (subapi.Subscription, bool) { | ||
| func (c *ComponentStore) ListSubscriptionsStreamByPubSub(name string) []*NamedSubscription { |
There was a problem hiding this comment.
| func (c *ComponentStore) ListSubscriptionsStreamByPubSub(name string) []*NamedSubscription { | |
| func (c *ComponentStore) ListPubSubSubscriptionsStreams(name string) []*NamedSubscription { |
Adds SubscribeTopicEvents proto API which dynamically subscribes to pubsub topics based on dapr/proposals#52. This is a basic gRPC implementation of the API whereby, like Subscription hot-reloading today, subscribing to a topic will reload _every_ active subscription for the current daprd. In a future PR, reloading of Subscriptions will be granular to the specific pubsub topic. Stream subscriptions are also only active once daprd declares the application as both present and ready. Dynamic stream subscriptions should be active both whether a app is running or not, as well as whether it is ready or not. This will be addressed in a future PR. Signed-off-by: joshvanl <[email protected]>
healthz. Refactors pubsub machinery to allow for gRPC bi-directional subcription streaming when there is no application, or the application in unhealhty. dapr/proposals#52 Signed-off-by: joshvanl <[email protected]>
Signed-off-by: joshvanl <[email protected]>
Signed-off-by: joshvanl <[email protected]>
Index on per subscription so that streams or Subscription hot reloading events will only reload that specific subscription, rather than reloading _every_ subscription for that PubSub component. This dramatically reduces disruption to topic subscriptions for a given PubSub component. Signed-off-by: joshvanl <[email protected]>
Signed-off-by: joshvanl <[email protected]>
Signed-off-by: joshvanl <[email protected]>
3679fff to
99bafe8
Compare
| } | ||
|
|
||
| if err := a.processor.Subscriber().ReloadPubSub(req.GetPubsubName()); err != nil { | ||
| if err := a.processor.Subscriber().StartStreamerSubscription(key); err != nil { |
There was a problem hiding this comment.
Can key ever be empty or nil and if so should we do a nil check before starting the streamer subscription? I only see key being returned here key := a.pubsubAdapterStreamer.StreamerKey(req.GetPubsubName(), req.GetTopic()) but am uncertain if it could cause issues if returned unset and used?
There was a problem hiding this comment.
No, key is just a string concatenation function of the given strings so it won't be nil or empty
dapr/pkg/runtime/pubsub/streamer/streamer.go
Line 167 in 47a5b3a
* Subscriptions: bi-directional subscription & publish streaming. Adds SubscribeTopicEvents proto API which dynamically subscribes to pubsub topics based on dapr/proposals#52. This is a basic gRPC implementation of the API whereby, like Subscription hot-reloading today, subscribing to a topic will reload _every_ active subscription for the current daprd. In a future PR, reloading of Subscriptions will be granular to the specific pubsub topic. Stream subscriptions are also only active once daprd declares the application as both present and ready. Dynamic stream subscriptions should be active both whether a app is running or not, as well as whether it is ready or not. This will be addressed in a future PR. Signed-off-by: joshvanl <[email protected]> * Subscriptions: bi-directional subscription streaming- subscribe on no healthz. Refactors pubsub machinery to allow for gRPC bi-directional subcription streaming when there is no application, or the application in unhealhty. dapr/proposals#52 Signed-off-by: joshvanl <[email protected]> * Fix unit tests Signed-off-by: joshvanl <[email protected]> * Fix subscription allowed Signed-off-by: joshvanl <[email protected]> * Subscriptions: bi-di index on per subscription Index on per subscription so that streams or Subscription hot reloading events will only reload that specific subscription, rather than reloading _every_ subscription for that PubSub component. This dramatically reduces disruption to topic subscriptions for a given PubSub component. Signed-off-by: joshvanl <[email protected]> * Lock streamer when sending topic mesgae to stream connection Signed-off-by: joshvanl <[email protected]> * Log Info when a streaming subscription unsubscribes Signed-off-by: joshvanl <[email protected]> --------- Signed-off-by: joshvanl <[email protected]> Signed-off-by: Annu Singh <[email protected]>
* Subscriptions: bi-directional subscription & publish streaming. Adds SubscribeTopicEvents proto API which dynamically subscribes to pubsub topics based on dapr/proposals#52. This is a basic gRPC implementation of the API whereby, like Subscription hot-reloading today, subscribing to a topic will reload _every_ active subscription for the current daprd. In a future PR, reloading of Subscriptions will be granular to the specific pubsub topic. Stream subscriptions are also only active once daprd declares the application as both present and ready. Dynamic stream subscriptions should be active both whether a app is running or not, as well as whether it is ready or not. This will be addressed in a future PR. Signed-off-by: joshvanl <[email protected]> * Subscriptions: bi-directional subscription streaming- subscribe on no healthz. Refactors pubsub machinery to allow for gRPC bi-directional subcription streaming when there is no application, or the application in unhealhty. dapr/proposals#52 Signed-off-by: joshvanl <[email protected]> * Fix unit tests Signed-off-by: joshvanl <[email protected]> * Fix subscription allowed Signed-off-by: joshvanl <[email protected]> * Subscriptions: bi-di index on per subscription Index on per subscription so that streams or Subscription hot reloading events will only reload that specific subscription, rather than reloading _every_ subscription for that PubSub component. This dramatically reduces disruption to topic subscriptions for a given PubSub component. Signed-off-by: joshvanl <[email protected]> * Lock streamer when sending topic mesgae to stream connection Signed-off-by: joshvanl <[email protected]> * Log Info when a streaming subscription unsubscribes Signed-off-by: joshvanl <[email protected]> --------- Signed-off-by: joshvanl <[email protected]> Signed-off-by: Jake Engelberg <[email protected]>
Index on per subscription so that streams or Subscription hot reloading events will only reload that specific subscription, rather than reloading every subscription for that PubSub component. This dramatically reduces disruption to topic subscriptions for a given PubSub component.
Branched from #7757
dapr/proposals#52