subscribeprep

package
v1.0.100 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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