subscribeprep

package
v1.0.89 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 4 Imported by: 0

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

View Source
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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL