subscription

package
v1.0.26 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package subscription deals with subscriptions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Func

type Func func(msg *message.Message)

Func is the function to call when a message is received.

type Subscription

type Subscription struct {
	common.Common

	// Func is the function to call when a message is received. It handles the
	// message.
	Func Func `json:"-"`

	// Channel is the channel to receive messages.
	Channel chan *message.Message `json:"-"`
}

Subscription is a subscription to a topic.

func MustNew added in v1.0.14

func MustNew(topic, queue string, callback Func) *Subscription

MustNew creates a new subscription, panicking if there's an error.

func New

func New(topic, queue string, callback Func) (*Subscription, error)

New creates a new subscription. topic and queue should be in the form of the following example: "v1.meta.created" and "v1.meta.created.queue".

Jump to

Keyboard shortcuts

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