queue

package
v0.44.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MessageMockMarshalProxyContext = func() (pctx inject.ProxyContext) {
		pctx = messageMockCommonProxyContext
		pctx.MethodName = "Marshal"
		return
	}()
	MessageMockUnmarshalProxyContext = func() (pctx inject.ProxyContext) {
		pctx = messageMockCommonProxyContext
		pctx.MethodName = "Unmarshal"
		return
	}()
)
View Source
var (
	ConsumerMockConsumeProxyContext = func() (pctx inject.ProxyContext) {
		pctx = consumerMockCommonProxyContext
		pctx.MethodName = "Consume"
		return
	}()
)
View Source
var (
	ProducerMockProduceProxyContext = func() (pctx inject.ProxyContext) {
		pctx = producerMockCommonProxyContext
		pctx.MethodName = "Produce"
		return
	}()
)
View Source
var (
	ReceiptMockStringProxyContext = func() (pctx inject.ProxyContext) {
		pctx = receiptMockCommonProxyContext
		pctx.MethodName = "String"
		return
	}()
)
View Source
var (
	TopicMockNameProxyContext = func() (pctx inject.ProxyContext) {
		pctx = topicMockCommonProxyContext
		pctx.MethodName = "Name"
		return
	}()
)

Functions

func RegisterProxyMethod

func RegisterProxyMethod(pctx inject.ProxyContext, cf inject.CtxFunc)

Types

type Consumer

type Consumer interface {
	Consume(topic Topic, f func(msg Message) error) error
}

type ConsumerMock

type ConsumerMock struct {
	ConsumeFunc func(topic Topic, f func(msg Message) error) error
}

func (*ConsumerMock) Consume

func (mockRecv *ConsumerMock) Consume(topic Topic, f func(msg Message) error) error

type Element

type Element interface {
	~int | ~string | ~struct{ Name string }
}

type MemMessage

type MemMessage[T Element] struct {
	Id   string       `json:"id"`
	Data map[string]T `json:"data"`
}

func (*MemMessage[T]) Marshal

func (msg *MemMessage[T]) Marshal() ([]byte, error)

func (*MemMessage[T]) Unmarshal

func (msg *MemMessage[T]) Unmarshal(data []byte) error

type MemReceipt

type MemReceipt struct {
	Id string `json:"id"`
}

func (*MemReceipt) String

func (receipt *MemReceipt) String() string

type Message

type Message interface {
	Marshal() ([]byte, error)
	Unmarshal([]byte) error
}

type MessageMock

type MessageMock struct {
	MarshalFunc func() ([]byte, error)

	UnmarshalFunc func([]byte) error
}

func (*MessageMock) Marshal

func (mockRecv *MessageMock) Marshal() ([]byte, error)

func (*MessageMock) Unmarshal

func (mockRecv *MessageMock) Unmarshal(p0 []byte) error

type Producer

type Producer interface {
	Produce(topic Topic, msg Message) (Receipt, error)
}

type ProducerMock

type ProducerMock struct {
	ProduceFunc func(topic Topic, msg Message) (Receipt, error)
}

func (*ProducerMock) Produce

func (mockRecv *ProducerMock) Produce(topic Topic, msg Message) (Receipt, error)

type Queue

type Queue interface {
	AddTopic(name string) Topic
	TopicByName(name string) (Topic, bool)
	Topics() []Topic

	Producer
	Consumer
}

func NewQueue

func NewQueue[T Message]() Queue

type Receipt

type Receipt interface {
	String() string
}

type ReceiptMock

type ReceiptMock struct {
	StringFunc func() string
}

func (*ReceiptMock) String

func (mockRecv *ReceiptMock) String() string

type Topic

type Topic interface {
	Name() string
}

type TopicMock

type TopicMock struct {
	NameFunc func() string
}

func (*TopicMock) Name

func (mockRecv *TopicMock) Name() string

Jump to

Keyboard shortcuts

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