message

package
v0.0.2-test Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDone

func IsDone(handler Handler) bool

IsDone returns true and terminates processing if the handler is doneHandlerInstance.

func IsError

func IsError(h Handler) bool

Types

type HandleFunc

type HandleFunc func(ctx context.Context, message *Message) Handler

HandleFunc is a func to handle the message received from a subscription

func (HandleFunc) Do

Do wraps a service message and returns a handlers

type Handler

type Handler interface {
	Do(ctx context.Context, orig Handler, message *servicebus.Message) Handler
}

Handler is the interface to handle messages

func Abandon

func Abandon() Handler

Abandon stops processing the message and releases the lock on it.

func Complete

func Complete() Handler

Complete will notify Azure Service Bus that the message was successfully handled and should be deleted from the queue

func DeadLetter

func DeadLetter(err error) Handler

DeadLetter will notify Azure Service Bus that the message will be sent to the deadletter queue

func Error

func Error(e error) Handler

Error is a wrapper around Abandon() that allows to trace the error before abandoning the message

func RetryLater

func RetryLater(retryAfter time.Duration) Handler

RetryLater waits for the given duration before abandoning the lock. Consider examining/increasing your LockDuration/MaxDeliveryCount before using. Undefined behavior if RetryLater is passed a duration that puts the message handling past the lock duration (which has a max of 5 minutes)

type Message

type Message struct {
	// contains filtered or unexported fields
}

Message is the wrapping type of service bus message with a type

func New

func New(msg *servicebus.Message) (*Message, error)

New creates a message, validating type first

func (*Message) Abandon

func (m *Message) Abandon() Handler

Abandon will notify Azure Service Bus the message failed but should be re-queued for delivery.

func (*Message) Complete

func (m *Message) Complete() Handler

Complete will notify Azure Service Bus that the message was successfully handled and should be deleted from the queue

func (*Message) Data

func (m *Message) Data() string

Data returns the message data as a string. Can be unmarshalled to the original struct

func (*Message) Error

func (m *Message) Error(err error) Handler

Error is a wrapper around Abandon() that allows to trace the error before abandoning the message

func (*Message) Message

func (m *Message) Message() *servicebus.Message

Message returns the message as received by the SDK

func (*Message) RetryLater

func (m *Message) RetryLater(retryAfter time.Duration) Handler

RetryLater waits for the given duration before retrying the processing of the message. This happens in memory and does not impact servicebus message max retry limit

func (*Message) Type

func (m *Message) Type() string

Type returns the message type as a string, passed on the message UserProperties

func (*Message) Unmarshal

func (m *Message) Unmarshal(data []byte, v interface{}) error

Jump to

Keyboard shortcuts

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