am

package
v0.0.0-...-76fafce Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommandHdrPrefix       = "COMMAND_"
	CommandNameHdr         = CommandHdrPrefix + "NAME"
	CommandReplyChannelHdr = CommandHdrPrefix + "REPLY_CHANNEL"
)
View Source
const (
	FailureReply = "am.Failure"
	SuccessReply = "am.Success"

	OutcomeSuccess = "SUCCESS"
	OutcomeFailure = "FAILURE"

	ReplyHdrPrefix  = "REPLY_"
	ReplyNameHdr    = ReplyHdrPrefix + "NAME"
	ReplyOutcomeHdr = ReplyHdrPrefix + "OUTCOME"
)

Variables

View Source
var File_message_types_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type AckType

type AckType int
const (
	AckTypeAuto AckType = iota
	AckTypeManual
)

type AckWait

type AckWait time.Duration

type CommandMessage

type CommandMessage interface {
	MessageBase
	ddd.Command
}

type CommandMessageData

type CommandMessageData struct {
	Payload    []byte                 `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
	OccurredAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=occurred_at,json=occurredAt,proto3" json:"occurred_at,omitempty"`
	// contains filtered or unexported fields
}

func (*CommandMessageData) Descriptor deprecated

func (*CommandMessageData) Descriptor() ([]byte, []int)

Deprecated: Use CommandMessageData.ProtoReflect.Descriptor instead.

func (*CommandMessageData) GetOccurredAt

func (x *CommandMessageData) GetOccurredAt() *timestamppb.Timestamp

func (*CommandMessageData) GetPayload

func (x *CommandMessageData) GetPayload() []byte

func (*CommandMessageData) ProtoMessage

func (*CommandMessageData) ProtoMessage()

func (*CommandMessageData) ProtoReflect

func (x *CommandMessageData) ProtoReflect() protoreflect.Message

func (*CommandMessageData) Reset

func (x *CommandMessageData) Reset()

func (*CommandMessageData) String

func (x *CommandMessageData) String() string

type CommandPublisher

type CommandPublisher interface {
	Publish(ctx context.Context, topicName string, cmd ddd.Command) error
}

func NewCommandPublisher

func NewCommandPublisher(reg registry.Registry, msgPublisher MessagePublisher, mws ...MessagePublisherMiddleware) CommandPublisher

type EventMessage

type EventMessage interface {
	MessageBase
	ddd.Event
}

type EventMessageData

type EventMessageData struct {
	Payload    []byte                 `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
	OccurredAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=occurred_at,json=occurredAt,proto3" json:"occurred_at,omitempty"`
	// contains filtered or unexported fields
}

func (*EventMessageData) Descriptor deprecated

func (*EventMessageData) Descriptor() ([]byte, []int)

Deprecated: Use EventMessageData.ProtoReflect.Descriptor instead.

func (*EventMessageData) GetOccurredAt

func (x *EventMessageData) GetOccurredAt() *timestamppb.Timestamp

func (*EventMessageData) GetPayload

func (x *EventMessageData) GetPayload() []byte

func (*EventMessageData) ProtoMessage

func (*EventMessageData) ProtoMessage()

func (*EventMessageData) ProtoReflect

func (x *EventMessageData) ProtoReflect() protoreflect.Message

func (*EventMessageData) Reset

func (x *EventMessageData) Reset()

func (*EventMessageData) String

func (x *EventMessageData) String() string

type EventPublisher

type EventPublisher interface {
	Publish(ctx context.Context, topicName string, event ddd.Event) error
}

func NewEventPublisher

func NewEventPublisher(reg registry.Registry, msgPublisher MessagePublisher, mws ...MessagePublisherMiddleware) EventPublisher

type FakeEventPublisher

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

func NewFakeEventPublisher

func NewFakeEventPublisher() *FakeEventPublisher

func (*FakeEventPublisher) Last

func (p *FakeEventPublisher) Last() (string, ddd.Event, error)

func (*FakeEventPublisher) Publish

func (p *FakeEventPublisher) Publish(ctx context.Context, topicName string, evt ddd.Event) error

func (*FakeEventPublisher) Reset

func (p *FakeEventPublisher) Reset()

type GroupName

type GroupName string

type IncomingCommandMessage

type IncomingCommandMessage interface {
	IncomingMessageBase
	ddd.Command
}

type IncomingEventMessage

type IncomingEventMessage interface {
	IncomingMessageBase
	ddd.Event
}

type IncomingMessage

type IncomingMessage interface {
	IncomingMessageBase
	Data() []byte
}

type IncomingMessageBase

type IncomingMessageBase interface {
	MessageBase
	ReceivedAt() time.Time
	Ack() error
	NAck() error
	Extend() error
	Kill() error
}

type IncomingReplyMessage

type IncomingReplyMessage interface {
	IncomingMessageBase
	ddd.Reply
}

type MaxRedeliver

type MaxRedeliver int

type Message

type Message interface {
	MessageBase
	Data() []byte
}

type MessageBase

type MessageBase interface {
	ddd.IDer
	Subject() string
	MessageName() string
	Metadata() ddd.Metadata
	SentAt() time.Time
}

type MessageFilter

type MessageFilter []string

type MessageHandler

type MessageHandler interface {
	HandleMessage(ctx context.Context, msg IncomingMessage) error
}

func MessageHandlerWithMiddleware

func MessageHandlerWithMiddleware(handler MessageHandler, mws ...MessageHandlerMiddleware) MessageHandler

MessageHandlerWithMiddleware builds a applyMiddleware chain around a handler

Middleware are applied in reverse; this makes the first applyMiddleware in the slice the outermost i.e. first to enter, last to exit given: handler, A, B, C result: A(B(C(handler)))

type MessageHandlerFunc

type MessageHandlerFunc func(ctx context.Context, msg IncomingMessage) error

func (MessageHandlerFunc) HandleMessage

func (f MessageHandlerFunc) HandleMessage(ctx context.Context, cmd IncomingMessage) error

type MessageHandlerMiddleware

type MessageHandlerMiddleware = func(next MessageHandler) MessageHandler

type MessagePublisher

type MessagePublisher interface {
	Publish(ctx context.Context, topicName string, msg Message) error
}

func MessagePublisherWithMiddleware

func MessagePublisherWithMiddleware(publisher MessagePublisher, mws ...MessagePublisherMiddleware) MessagePublisher

MessagePublisherWithMiddleware builds a applyMiddleware chain around a publisher

Middleware are applied in reverse; this makes the first applyMiddleware in the slice the outermost i.e. first to enter, last to exit given: publisher, A, B, C result: A(B(C(publisher)))

func NewMessagePublisher

func NewMessagePublisher(publisher MessagePublisher, mws ...MessagePublisherMiddleware) MessagePublisher

type MessagePublisherFunc

type MessagePublisherFunc func(ctx context.Context, topicName string, msg Message) error

func (MessagePublisherFunc) Publish

func (f MessagePublisherFunc) Publish(ctx context.Context, topicName string, msg Message) error

type MessagePublisherMiddleware

type MessagePublisherMiddleware = func(next MessagePublisher) MessagePublisher

type MessageStream

type MessageStream interface {
	MessageSubscriber
	MessagePublisher
}

func MessageStreamWithMiddleware

func MessageStreamWithMiddleware(stream MessageStream, mws ...MessageStreamMiddleware) MessageStream

MessageStreamWithMiddleware builds a applyMiddleware chain around a stream

Middleware are applied in reverse; this makes the first applyMiddleware in the slice the outermost i.e. first to enter, last to exit given: stream, A, B, C result: A(B(C(stream)))

type MessageStreamMiddleware

type MessageStreamMiddleware = func(next MessageStream) MessageStream

type MessageSubscriber

type MessageSubscriber interface {
	Subscribe(topicName string, handler MessageHandler, options ...SubscriberOption) (Subscription, error)
	Unsubscribe() error
}

func NewMessageSubscriber

func NewMessageSubscriber(subscriber MessageSubscriber, mws ...MessageHandlerMiddleware) MessageSubscriber

type MockCommandPublisher

type MockCommandPublisher struct {
	mock.Mock
}

MockCommandPublisher is an autogenerated mock type for the CommandPublisher type

func NewMockCommandPublisher

func NewMockCommandPublisher(t mockConstructorTestingTNewMockCommandPublisher) *MockCommandPublisher

NewMockCommandPublisher creates a new instance of MockCommandPublisher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockCommandPublisher) Publish

func (_m *MockCommandPublisher) Publish(ctx context.Context, topicName string, cmd ddd.Command) error

Publish provides a mock function with given fields: ctx, topicName, cmd

type MockEventPublisher

type MockEventPublisher struct {
	mock.Mock
}

MockEventPublisher is an autogenerated mock type for the EventPublisher type

func NewMockEventPublisher

func NewMockEventPublisher(t mockConstructorTestingTNewMockEventPublisher) *MockEventPublisher

NewMockEventPublisher creates a new instance of MockEventPublisher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockEventPublisher) Publish

func (_m *MockEventPublisher) Publish(ctx context.Context, topicName string, event ddd.Event) error

Publish provides a mock function with given fields: ctx, topicName, event

type MockReplyPublisher

type MockReplyPublisher struct {
	mock.Mock
}

MockReplyPublisher is an autogenerated mock type for the ReplyPublisher type

func NewMockReplyPublisher

func NewMockReplyPublisher(t mockConstructorTestingTNewMockReplyPublisher) *MockReplyPublisher

NewMockReplyPublisher creates a new instance of MockReplyPublisher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockReplyPublisher) Publish

func (_m *MockReplyPublisher) Publish(ctx context.Context, topicName string, reply ddd.Reply) error

Publish provides a mock function with given fields: ctx, topicName, reply

type ReplyMessage

type ReplyMessage interface {
	MessageBase
	ddd.Reply
}

type ReplyMessageData

type ReplyMessageData struct {
	Payload    []byte                 `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
	OccurredAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=occurred_at,json=occurredAt,proto3" json:"occurred_at,omitempty"`
	// contains filtered or unexported fields
}

func (*ReplyMessageData) Descriptor deprecated

func (*ReplyMessageData) Descriptor() ([]byte, []int)

Deprecated: Use ReplyMessageData.ProtoReflect.Descriptor instead.

func (*ReplyMessageData) GetOccurredAt

func (x *ReplyMessageData) GetOccurredAt() *timestamppb.Timestamp

func (*ReplyMessageData) GetPayload

func (x *ReplyMessageData) GetPayload() []byte

func (*ReplyMessageData) ProtoMessage

func (*ReplyMessageData) ProtoMessage()

func (*ReplyMessageData) ProtoReflect

func (x *ReplyMessageData) ProtoReflect() protoreflect.Message

func (*ReplyMessageData) Reset

func (x *ReplyMessageData) Reset()

func (*ReplyMessageData) String

func (x *ReplyMessageData) String() string

type ReplyPublisher

type ReplyPublisher interface {
	Publish(ctx context.Context, topicName string, reply ddd.Reply) error
}

func NewReplyPublisher

func NewReplyPublisher(reg registry.Registry, msgPublisher MessagePublisher, mws ...MessagePublisherMiddleware) ReplyPublisher

type SubscriberConfig

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

func NewSubscriberConfig

func NewSubscriberConfig(options []SubscriberOption) SubscriberConfig

func (SubscriberConfig) AckType

func (c SubscriberConfig) AckType() AckType

func (SubscriberConfig) AckWait

func (c SubscriberConfig) AckWait() time.Duration

func (SubscriberConfig) GroupName

func (c SubscriberConfig) GroupName() string

func (SubscriberConfig) MaxRedeliver

func (c SubscriberConfig) MaxRedeliver() int

func (SubscriberConfig) MessageFilters

func (c SubscriberConfig) MessageFilters() []string

type SubscriberOption

type SubscriberOption interface {
	// contains filtered or unexported methods
}

type Subscription

type Subscription interface {
	Unsubscribe() error
}

Jump to

Keyboard shortcuts

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