rpc

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 12, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package rpc provides functionality for request / reply messaging. It is used by package mgmt and cbs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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

Link is the bidirectional communication structure used for CBS negotiation

func NewLink(conn *amqp.Client, address string, opts ...LinkOption) (*Link, error)

NewLink will build a new request response link

func NewLinkWithSession

func NewLinkWithSession(session *amqp.Session, address string, opts ...LinkOption) (*Link, error)

NewLinkWithSession will build a new request response link, but will reuse an existing AMQP session

func (*Link) Close

func (l *Link) Close(ctx context.Context) error

Close the link receiver, sender and session

func (*Link) RPC

func (l *Link) RPC(ctx context.Context, msg *amqp.Message) (*Response, error)

RPC sends a request and waits on a response for that request

func (*Link) RetryableRPC

func (l *Link) RetryableRPC(ctx context.Context, times int, delay time.Duration, msg *amqp.Message) (*Response, error)

RetryableRPC attempts to retry a request a number of times with delay

type LinkOption

type LinkOption func(link *Link) error

LinkOption provides a way to customize the construction of a Link

func LinkWithSessionFilter

func LinkWithSessionFilter(sessionID *string) LinkOption

LinkWithSessionFilter configures a Link to use a session filter

type Response

type Response struct {
	Code        int
	Description string
	Message     *amqp.Message
}

Response is the simplified response structure from an RPC like call

Jump to

Keyboard shortcuts

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