Documentation
¶
Index ¶
- Constants
- Variables
- type AckType
- type AckWait
- type CommandMessage
- type CommandMessageData
- func (*CommandMessageData) Descriptor() ([]byte, []int)deprecated
- func (x *CommandMessageData) GetOccurredAt() *timestamppb.Timestamp
- func (x *CommandMessageData) GetPayload() []byte
- func (*CommandMessageData) ProtoMessage()
- func (x *CommandMessageData) ProtoReflect() protoreflect.Message
- func (x *CommandMessageData) Reset()
- func (x *CommandMessageData) String() string
- type CommandPublisher
- type EventMessage
- type EventMessageData
- func (*EventMessageData) Descriptor() ([]byte, []int)deprecated
- func (x *EventMessageData) GetOccurredAt() *timestamppb.Timestamp
- func (x *EventMessageData) GetPayload() []byte
- func (*EventMessageData) ProtoMessage()
- func (x *EventMessageData) ProtoReflect() protoreflect.Message
- func (x *EventMessageData) Reset()
- func (x *EventMessageData) String() string
- type EventPublisher
- type GroupName
- type IncomingCommandMessage
- type IncomingEventMessage
- type IncomingMessage
- type IncomingMessageBase
- type IncomingReplyMessage
- type MaxRedeliver
- type Message
- type MessageBase
- type MessageFilter
- type MessageHandler
- func MessageHandlerWithMiddleware(handler MessageHandler, mws ...MessageHandlerMiddleware) MessageHandler
- func NewCommandHandler(reg registry.Registry, publisher ReplyPublisher, ...) MessageHandler
- func NewEventHandler(reg registry.Registry, handler ddd.EventHandler[ddd.Event], ...) MessageHandler
- func NewReplyHandler(reg registry.Registry, handler ddd.ReplyHandler[ddd.Reply], ...) MessageHandler
- type MessageHandlerFunc
- type MessageHandlerMiddleware
- type MessagePublisher
- type MessagePublisherFunc
- type MessagePublisherMiddleware
- type MessageStream
- type MessageStreamMiddleware
- type MessageSubscriber
- type MockCommandPublisher
- type MockEventPublisher
- type MockMessageHandler
- type MockMessagePublisher
- type MockMessageSubscriber
- type MockReplyPublisher
- type ReplyMessage
- type ReplyMessageData
- func (*ReplyMessageData) Descriptor() ([]byte, []int)deprecated
- func (x *ReplyMessageData) GetOccurredAt() *timestamppb.Timestamp
- func (x *ReplyMessageData) GetPayload() []byte
- func (*ReplyMessageData) ProtoMessage()
- func (x *ReplyMessageData) ProtoReflect() protoreflect.Message
- func (x *ReplyMessageData) Reset()
- func (x *ReplyMessageData) String() string
- type ReplyPublisher
- type SubscriberConfig
- type SubscriberOption
- type Subscription
Constants ¶
const ( CommandHdrPrefix = "COMMAND_" CommandNameHdr = CommandHdrPrefix + "NAME" CommandReplyChannelHdr = CommandHdrPrefix + "REPLY_CHANNEL" )
const ( FailureReply = "async.Failure" SuccessReply = "async.Success" OutcomeSuccess = "SUCCESS" OutcomeFailure = "FAILURE" ReplyHdrPrefix = "REPLY_" ReplyNameHdr = ReplyHdrPrefix + "NAME" ReplyOutcomeHdr = ReplyHdrPrefix + "OUTCOME" )
Variables ¶
var File_message_types_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
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 ¶
func NewCommandPublisher ¶
func NewCommandPublisher(reg registry.Registry, publisher MessagePublisher, msw ...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 ¶
func NewEventPublisher ¶
func NewEventPublisher(reg registry.Registry, msgPublisher MessagePublisher, mws ...MessagePublisherMiddleware) EventPublisher
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 IncomingReplyMessage ¶
type IncomingReplyMessage interface { IncomingMessageBase ddd.Reply }
type MaxRedeliver ¶
type MaxRedeliver int
type Message ¶
type Message interface { MessageBase Data() []byte }
type MessageBase ¶
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)))
func NewCommandHandler ¶
func NewCommandHandler(reg registry.Registry, publisher ReplyPublisher, handler ddd.CommandHandler[ddd.Command], msw ...MessageHandlerMiddleware) MessageHandler
func NewEventHandler ¶
func NewEventHandler(reg registry.Registry, handler ddd.EventHandler[ddd.Event], mws ...MessageHandlerMiddleware) MessageHandler
func NewReplyHandler ¶
func NewReplyHandler(reg registry.Registry, handler ddd.ReplyHandler[ddd.Reply], mws ...MessageHandlerMiddleware) MessageHandler
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 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 ¶
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.
type MockEventPublisher ¶
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.
type MockMessageHandler ¶
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 ¶
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.
type MockMessageSubscriber ¶
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 ¶
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.
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
}
Source Files
¶
- command_messages.go
- event_messages.go
- generate.go
- message.go
- message_types.pb.go
- middleware.go
- mock_command_publisher.go
- mock_event_publisher.go
- mock_message_handler.go
- mock_message_publisher.go
- mock_message_subscriber.go
- mock_reply_publisher.go
- reply_messages.go
- subscriber_config.go
- subscription.go