am

package
v0.0.0-...-0ebfa01 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 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 Command

type Command interface {
	ddd.Command
	Destination() string
}

func NewCommand

func NewCommand(name, destination string, payload ddd.CommandPayload, options ...ddd.CommandOption) Command

type CommandMessage

type CommandMessage interface {
	Message
	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"`
	Metadata   *structpb.Struct       `protobuf:"bytes,3,opt,name=metadata,proto3" json:"metadata,omitempty"`
	// contains filtered or unexported fields
}

func (*CommandMessageData) Descriptor deprecated

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

Deprecated: Use CommandMessageData.ProtoReflect.Descriptor instead.

func (*CommandMessageData) GetMetadata

func (x *CommandMessageData) GetMetadata() *structpb.Struct

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 CommandMessageHandler

type CommandMessageHandler = MessageHandler[IncomingCommandMessage]

type CommandMessageHandlerFunc

type CommandMessageHandlerFunc func(ctx context.Context, msg IncomingCommandMessage) error

func (CommandMessageHandlerFunc) HandleMessage

type CommandPublisher

type CommandPublisher = MessagePublisher[ddd.Command]

type CommandStream

type CommandStream interface {
	MessagePublisher[ddd.Command]
	MessageSubscriber[IncomingCommandMessage]
}

func NewCommandStream

func NewCommandStream(reg registry.Registry, stream RawMessageStream) CommandStream

type CommandSubscriber

type CommandSubscriber = MessageSubscriber[IncomingCommandMessage]

type EventMessage

type EventMessage interface {
	Message
	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"`
	Metadata   *structpb.Struct       `protobuf:"bytes,3,opt,name=metadata,proto3" json:"metadata,omitempty"`
	// contains filtered or unexported fields
}

func (*EventMessageData) Descriptor deprecated

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

Deprecated: Use EventMessageData.ProtoReflect.Descriptor instead.

func (*EventMessageData) GetMetadata

func (x *EventMessageData) GetMetadata() *structpb.Struct

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 = MessagePublisher[ddd.Event]

type EventStream

type EventStream = MessageStream[ddd.Event, IncomingEventMessage]

func NewEventStream

func NewEventStream(reg registry.Registry, stream RawMessageStream) EventStream

type EventSubscriber

type EventSubscriber = MessageSubscriber[IncomingEventMessage]

type FakeMessagePublisher

type FakeMessagePublisher[O any] struct {
	// contains filtered or unexported fields
}

func NewFakeMessagePublisher

func NewFakeMessagePublisher[O any]() *FakeMessagePublisher[O]

func (*FakeMessagePublisher[O]) Last

func (p *FakeMessagePublisher[O]) Last() (string, O, error)

func (*FakeMessagePublisher[O]) Publish

func (p *FakeMessagePublisher[O]) Publish(ctx context.Context, topicName string, v O) error

func (*FakeMessagePublisher[O]) Reset

func (p *FakeMessagePublisher[O]) Reset()

type GroupName

type GroupName string

type IncomingCommandMessage

type IncomingCommandMessage interface {
	IncomingMessage
	ddd.Command
}

type IncomingEventMessage

type IncomingEventMessage interface {
	IncomingMessage
	ddd.Event
}

type IncomingMessage

type IncomingMessage interface {
	Message
	Ack() error
	NAck() error
	Extend() error
	Kill() error
}

type IncomingRawMessage

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

type IncomingReplyMessage

type IncomingReplyMessage interface {
	IncomingMessage
	ddd.Reply
}

type MaxRedeliver

type MaxRedeliver int

type Message

type Message interface {
	ddd.IDer
	Subject() string
	MessageName() string
}

type MessageFilter

type MessageFilter []string

type MessageHandler

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

type MessageHandlerFunc

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

func (MessageHandlerFunc[I]) HandleMessage

func (f MessageHandlerFunc[I]) HandleMessage(ctx context.Context, msg I) error

type MessagePublisher

type MessagePublisher[O any] interface {
	Publish(ctx context.Context, topicName string, v O) error
}

type MessageStream

type MessageStream[O any, I IncomingMessage] interface {
	MessagePublisher[O]
	MessageSubscriber[I]
}

type MessageSubscriber

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

type MockMessageHandler

type MockMessageHandler[I IncomingMessage] struct {
	mock.Mock
}

MockMessageHandler is an autogenerated mock type for the MessageHandler type

func NewMockMessageHandler

func NewMockMessageHandler[I IncomingMessage](t mockConstructorTestingTNewMockMessageHandler) *MockMessageHandler[I]

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

func (*MockMessageHandler[I]) HandleMessage

func (_m *MockMessageHandler[I]) HandleMessage(ctx context.Context, msg I) error

HandleMessage provides a mock function with given fields: ctx, msg

type MockMessagePublisher

type MockMessagePublisher[O interface{}] struct {
	mock.Mock
}

MockMessagePublisher is an autogenerated mock type for the MessagePublisher type

func NewMockMessagePublisher

func NewMockMessagePublisher[O interface{}](t mockConstructorTestingTNewMockMessagePublisher) *MockMessagePublisher[O]

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

func (*MockMessagePublisher[O]) Publish

func (_m *MockMessagePublisher[O]) Publish(ctx context.Context, topicName string, v O) error

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

type MockMessageSubscriber

type MockMessageSubscriber[I IncomingMessage] struct {
	mock.Mock
}

MockMessageSubscriber is an autogenerated mock type for the MessageSubscriber type

func NewMockMessageSubscriber

func NewMockMessageSubscriber[I IncomingMessage](t mockConstructorTestingTNewMockMessageSubscriber) *MockMessageSubscriber[I]

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

func (*MockMessageSubscriber[I]) Subscribe

func (_m *MockMessageSubscriber[I]) Subscribe(topicName string, handler MessageHandler[I], options ...SubscriberOption) error

Subscribe provides a mock function with given fields: topicName, handler, options

type RawMessage

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

type RawMessageHandler

type RawMessageHandler = MessageHandler[IncomingRawMessage]

func NewCommandMessageHandler

func NewCommandMessageHandler(reg registry.Registry, publisher ReplyPublisher, handler ddd.CommandHandler[ddd.Command]) RawMessageHandler

func NewEventMessageHandler

func NewEventMessageHandler(reg registry.Registry, handler ddd.EventHandler[ddd.Event]) RawMessageHandler

func NewReplyMessageHandler

func NewReplyMessageHandler(reg registry.Registry, handler ddd.ReplyHandler[ddd.Reply]) RawMessageHandler

func RawMessageHandlerWithMiddleware

func RawMessageHandlerWithMiddleware(handler RawMessageHandler, mws ...RawMessageHandlerMiddleware) RawMessageHandler

type RawMessageHandlerFunc

type RawMessageHandlerFunc func(ctx context.Context, msg IncomingRawMessage) error

func (RawMessageHandlerFunc) HandleMessage

func (f RawMessageHandlerFunc) HandleMessage(ctx context.Context, cmd IncomingRawMessage) error

type RawMessageHandlerMiddleware

type RawMessageHandlerMiddleware = func(handler RawMessageHandler) RawMessageHandler

type RawMessagePublisher

type RawMessagePublisher = MessagePublisher[RawMessage]

type RawMessageStream

type RawMessageStream = MessageStream[RawMessage, IncomingRawMessage]

func RawMessageStreamWithMiddleware

func RawMessageStreamWithMiddleware(stream RawMessageStream, mws ...RawMessageStreamMiddleware) RawMessageStream

type RawMessageStreamMiddleware

type RawMessageStreamMiddleware = func(stream RawMessageStream) RawMessageStream

type RawMessageSubscriber

type RawMessageSubscriber = MessageSubscriber[IncomingRawMessage]

type ReplyMessage

type ReplyMessage interface {
	Message
	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"`
	Metadata   *structpb.Struct       `protobuf:"bytes,3,opt,name=metadata,proto3" json:"metadata,omitempty"`
	// contains filtered or unexported fields
}

func (*ReplyMessageData) Descriptor deprecated

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

Deprecated: Use ReplyMessageData.ProtoReflect.Descriptor instead.

func (*ReplyMessageData) GetMetadata

func (x *ReplyMessageData) GetMetadata() *structpb.Struct

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 = MessagePublisher[ddd.Reply]

type ReplyStream

type ReplyStream = MessageStream[ddd.Reply, IncomingReplyMessage]

func NewReplyStream

func NewReplyStream(reg registry.Registry, stream RawMessageStream) ReplyStream

type ReplySubscriber

type ReplySubscriber = MessageSubscriber[IncomingReplyMessage]

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