Codebase list golang-github-go-kit-kit / f9d8373b-9935-4125-b2b2-694ccabcf82b/v0.8.0 transport / amqp / encode-decode.go
f9d8373b-9935-4125-b2b2-694ccabcf82b/v0.8.0

Tree @f9d8373b-9935-4125-b2b2-694ccabcf82b/v0.8.0 (Download .tar.gz)

encode-decode.go @f9d8373b-9935-4125-b2b2-694ccabcf82b/v0.8.0raw · history · blame

package amqp

import (
	"context"
	"github.com/streadway/amqp"
)

// DecodeRequestFunc extracts a user-domain request object from
// an AMQP Delivery object. It is designed to be used in AMQP Subscribers.
type DecodeRequestFunc func(context.Context, *amqp.Delivery) (request interface{}, err error)

// EncodeRequestFunc encodes the passed request object into
// an AMQP Publishing object. It is designed to be used in AMQP Publishers.
type EncodeRequestFunc func(context.Context, *amqp.Publishing, interface{}) error

// EncodeResponseFunc encodes the passed reponse object to
// an AMQP Publishing object. It is designed to be used in AMQP Subscribers.
type EncodeResponseFunc func(context.Context, *amqp.Publishing, interface{}) error

// DecodeResponseFunc extracts a user-domain response object from
// an AMQP Delivery object. It is designed to be used in AMQP Publishers.
type DecodeResponseFunc func(context.Context, *amqp.Delivery) (response interface{}, err error)