handler

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package handler contains the reference interface for a message handler.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Func

type Func func(context.Context, amqp.Delivery) error

Func is a function that implements the Handler interface, useful to specify Handlers inline as simple functions.

func (Func) Handle

func (fn Func) Handle(ctx context.Context, delivery amqp.Delivery) error

Handle calls the underlying function to handle the incoming message.

type Handler

type Handler interface {
	Handle(context.Context, amqp.Delivery) error
}

Handler handles incoming messages from the AMQP broker, which are supplied to the application using an amqp.Delivery object.

An Handler is fallible, so it returns an error in case message handling failed.

In that case, the handled message should be negatively-acknowledged, either requeued or rejected, depending on the error value.

Directories

Path Synopsis
Package router contains a Router interface and Mux, message handler multiplexer, to allow for multiple message handlers to be assigned to multiple queues.
Package router contains a Router interface and Mux, message handler multiplexer, to allow for multiple message handlers to be assigned to multiple queues.

Jump to

Keyboard shortcuts

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