protocol

package
v0.0.0-...-c0583b9 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultQueueName = "default"

Variables

This section is empty.

Functions

func GetQueueName

func GetQueueName(fb *flatbuf.RequeueMessage) string

Types

type BackoffStrategy

type BackoffStrategy int8

BackoffStrategy mirrors the flatbuf enum.

const (
	BackoffStrategy_Undefined BackoffStrategy = iota
	BackoffStrategy_Exponential
	BackoffStrategy_Fixed
)

type InstanceStatsMessage

type InstanceStatsMessage struct {
	InstanceId string
	Queues     []QueueStatsMessage
}

func DefaultInstanceStatsMessage

func DefaultInstanceStatsMessage() InstanceStatsMessage

func InstanceStatsMessageFromNATS

func InstanceStatsMessageFromNATS(msg *nats.Msg) InstanceStatsMessage

func (*InstanceStatsMessage) Bytes

func (i *InstanceStatsMessage) Bytes() []byte

func (*InstanceStatsMessage) MarshalBinary

func (i *InstanceStatsMessage) MarshalBinary() ([]byte, error)

func (*InstanceStatsMessage) UnmarshalBinary

func (i *InstanceStatsMessage) UnmarshalBinary(data []byte) error

type QueueStatsMessage

type QueueStatsMessage struct {
	QueueName string
	Enqueued  int64
	InFlight  int64
}

func (*QueueStatsMessage) Bytes

func (q *QueueStatsMessage) Bytes() []byte

func (*QueueStatsMessage) MarshalBinary

func (q *QueueStatsMessage) MarshalBinary() ([]byte, error)

func (*QueueStatsMessage) UnmarshalBinary

func (q *QueueStatsMessage) UnmarshalBinary(data []byte) error

type RequeueMessage

type RequeueMessage struct {
	// The number of times requeue should be attempted.
	Retries uint64

	// The TTL for when the msssage should expire. This is useful for ensuring
	// messages are not retried after a certain time.
	TTL uint64

	// The delay before the message should be replayed in nanoseconds.
	Delay uint64

	// Backoff strategy that will be used for determining the next delay should
	// the message fail to be acknowledged on replay. i.e. fixed interval or
	// exponential
	BackoffStrategy BackoffStrategy

	// The persistence queue events will be stored in.
	// This can be useful if you need multiple queues by priority.
	// On the sever you can configure the priority certain queues
	// should have over other. This way you can ensure a given high volume
	// queue does not starve out a low volume queue.
	// The default queue is "default" when one is not provided.
	QueueName string

	// The original subject of the message.
	OriginalSubject string

	// Original message payload.
	OriginalPayload []byte
}

Things we need to save in order to replay this message:

  • The subject it was originally supposed to go to.
  • The number of times it should be retried.
  • The TTL for when the message should expire.
  • The delay before it should be retried again.
  • Backoff strategy. i.e. fixed interval or exponential

func DefaultRequeueMessage

func DefaultRequeueMessage() RequeueMessage

func RequeueMessageFromNATS

func RequeueMessageFromNATS(msg *nats.Msg) RequeueMessage

func (*RequeueMessage) Bytes

func (r *RequeueMessage) Bytes() []byte

func (*RequeueMessage) MarshalBinary

func (r *RequeueMessage) MarshalBinary() ([]byte, error)

func (*RequeueMessage) NewReader

func (r *RequeueMessage) NewReader() io.Reader

func (*RequeueMessage) UnmarshalBinary

func (r *RequeueMessage) UnmarshalBinary(data []byte) error

Jump to

Keyboard shortcuts

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