async

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommandHdrPrefix       = "COMMAND_"
	CommandNameHdr         = CommandHdrPrefix + "NAME"
	CommandReplyChannelHdr = CommandHdrPrefix + "REPLY_CHANNEL"
)
View Source
const (
	FailureReply = "async.Failure"
	SuccessReply = "async.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(context.Context, string, ddd.Command) error
}

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(context.Context, string, ddd.Event) error
}

func NewEventPublisher

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

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 {
	id.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 interface {
	mock.TestingT
	Cleanup(func())
}) *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. The first argument is typically a *testing.T value.

func (*MockCommandPublisher) Publish

func (_m *MockCommandPublisher) Publish(_a0 context.Context, _a1 string, _a2 ddd.Command) error

Publish provides a mock function with given fields: _a0, _a1, _a2

type MockEventPublisher

type MockEventPublisher struct {
	mock.Mock
}

MockEventPublisher is an autogenerated mock type for the EventPublisher type

func NewMockEventPublisher

func NewMockEventPublisher(t interface {
	mock.TestingT
	Cleanup(func())
}) *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. The first argument is typically a *testing.T value.

func (*MockEventPublisher) Publish

func (_m *MockEventPublisher) Publish(_a0 context.Context, _a1 string, _a2 ddd.Event) error

Publish provides a mock function with given fields: _a0, _a1, _a2

type MockMessageHandler

type MockMessageHandler struct {
	mock.Mock
}

MockMessageHandler is an autogenerated mock type for the MessageHandler type

func NewMockMessageHandler

func NewMockMessageHandler(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockMessageHandler

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. The first argument is typically a *testing.T value.

func (*MockMessageHandler) HandleMessage

func (_m *MockMessageHandler) HandleMessage(ctx context.Context, msg IncomingMessage) error

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

type MockMessagePublisher

type MockMessagePublisher struct {
	mock.Mock
}

MockMessagePublisher is an autogenerated mock type for the MessagePublisher type

func NewMockMessagePublisher

func NewMockMessagePublisher(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockMessagePublisher

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. The first argument is typically a *testing.T value.

func (*MockMessagePublisher) Publish

func (_m *MockMessagePublisher) Publish(ctx context.Context, topicName string, msg Message) error

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

type MockMessageSubscriber

type MockMessageSubscriber struct {
	mock.Mock
}

MockMessageSubscriber is an autogenerated mock type for the MessageSubscriber type

func NewMockMessageSubscriber

func NewMockMessageSubscriber(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockMessageSubscriber

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. The first argument is typically a *testing.T value.

func (*MockMessageSubscriber) Subscribe

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

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

func (*MockMessageSubscriber) Unsubscribe

func (_m *MockMessageSubscriber) Unsubscribe() error

Unsubscribe provides a mock function with given fields:

type MockReplyPublisher

type MockReplyPublisher struct {
	mock.Mock
}

MockReplyPublisher is an autogenerated mock type for the ReplyPublisher type

func NewMockReplyPublisher

func NewMockReplyPublisher(t interface {
	mock.TestingT
	Cleanup(func())
}) *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. The first argument is typically a *testing.T value.

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