Documentation
¶
Overview ¶
Package subscribeprep provides the shared PreConsume hook for EventKeys whose server-side subscription is a plain event_type register/unregister pair against fixed OAPI paths.
Index ¶
Constants ¶
const CleanupTimeout = 5 * time.Second
CleanupTimeout bounds how long the unsubscribe call has to finish during PreConsume cleanup so a stuck OAPI cannot block process shutdown.
Variables ¶
This section is empty.
Functions ¶
func Hook ¶
func Hook(eventType, subscribePath, unsubscribePath string) func(context.Context, processing.APIClient, map[string]string) (func() error, error)
Hook returns a PreConsume that subscribes eventType via subscribePath and hands back a cleanup that unsubscribes it via unsubscribePath.
func SubscribeWithCleanup ¶
func SubscribeWithCleanup(ctx context.Context, rt processing.APIClient, eventType, subscribePath, unsubscribePath string) (func() error, error)
SubscribeWithCleanup calls the subscribe OAPI for eventType and returns a cleanup that invokes the matching unsubscribe, bounded by CleanupTimeout. rt must be non-nil; callers that validate their own params (e.g. to build per-resource paths) run those checks first and then delegate here.
Types ¶
This section is empty.