Add Close() error
to bindings
#779
Labels
area/runtime/binding
good first issue
Good for newcomers
kind/enhancement
New feature or request
P1
size/S
1 week of work
Currently, the PubSub interface contains a
Closer() error
function so that the component can cleanly shutdown whendaprd
is stopped. This does not exist in bindings and that has resulted in binding implementations are having to usesignal.Notify
in order to stop a subscription, etc.Instead, PubSub and Binding interfaces could embed
io.Closer
. Many of the pubsub components have moved to using an internal content.Context for backoff/timeout purposes. TheClose
method should call thecancel
func returned bycontext.WithCancel
in order to idiomatically shutdown goroutines, etc.This likely involves a change to
dapr/dapr
(most likely inruntime.go
) to invokeClose
on shutdown. It's also possible for components to optionally implementio.Closer
so long as daprd checks for that and invokes accordingly. Our documentation on how to build a component would just need to make that clear.The text was updated successfully, but these errors were encountered: