mq

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const CECorrelIDAttr = "correlationid"

CECorrelIDAttr is the name of CloudEvent attribute used as IBM MQ Correlation ID.

Variables

This section is empty.

Functions

func NewConnection

func NewConnection(cfg *ConnConfig) (ibmmq.MQQueueManager, error)

NewConnection creates the connection to IBM MQ server.

Types

type ConnConfig

type ConnConfig struct {
	ChannelName    string
	ConnectionName string
	User           string
	Password       string
	QueueManager   string
	QueueName      string
}

ConnConfig is a set of connection parameters.

type Delivery

type Delivery struct {
	DeadLetterQManager string
	DeadLetterQueue    string
	BackoffDelay       int
	Retry              int
}

Delivery describes the message delivery details.

type EnvConnectionConfig

type EnvConnectionConfig struct {
	QueueManager   string `envconfig:"QUEUE_MANAGER"`
	ChannelName    string `envconfig:"CHANNEL_NAME"`
	ConnectionName string `envconfig:"CONNECTION_NAME"`
	User           string `envconfig:"USER"`
	Password       string `envconfig:"PASSWORD"`
	QueueName      string `envconfig:"QUEUE_NAME"`
}

EnvConnectionConfig is IBM MQ common connection parameters.

func (*EnvConnectionConfig) ConnectionConfig

func (e *EnvConnectionConfig) ConnectionConfig() *ConnConfig

ConnectionConfig returns the connection configuration.

type Handler

type Handler func([]byte, string) error

Handler is a function used as IBM MQ callback.

type Object

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

Object is a local wrapper for IBM MQ objects required to communicate with the queue.

func OpenQueue

func OpenQueue(queueName string, conn ibmmq.MQQueueManager) (Object, error)

OpenQueue opens IBM MQ queue.

func (*Object) Close

func (q *Object) Close() error

Close closes the queue.

func (*Object) DeleteMessageHandle

func (q *Object) DeleteMessageHandle() error

Deallocate the message handle

func (*Object) DeregisterCallback

func (q *Object) DeregisterCallback() error

Deregister the callback function - have to do this before the message handle can be successfully deleted

func (*Object) Put

func (q *Object) Put(data []byte, ceCorrelID string) error

Put puts the message to the queue.

func (*Object) RegisterCallback

func (q *Object) RegisterCallback(f Handler, delivery *Delivery, log *zap.SugaredLogger) error

RegisterCallback registers the callback function for the incoming messages in the target queue.

func (*Object) StartListen

func (q *Object) StartListen(conn ibmmq.MQQueueManager) error

StartListen sends the signal to IBM MQ server to start callback invocation.

func (*Object) StopCallback

func (q *Object) StopCallback(conn ibmmq.MQQueueManager) error

Stop the callback function from being called again

type ReplyTo

type ReplyTo struct {
	Manager string
	Queue   string
}

ReplyTo holds the data used in MQ's Reply-to header.

Jump to

Keyboard shortcuts

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