Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MessageQueue ¶
type MessageQueue interface { Subscribe(topic string, handler SubResponseHandler, opts ...SubOption) (Subscription, error) Publish(topic string, opts ...PubOption) error }
type PubOption ¶
type PubOption func(o *PubOptions) error
PubOption is a closure that updates PubOptions.
func WithDelay ¶
WithDelay Use WithDelay to set the value to defer the message. Deferring is to be done by the message queue, not mq.
func WithEncoder ¶
WithEncoder Use WithEncoder to set the PubOptions' Data field with with encoded data
type PubOptions ¶
PubOptions contains all the various options that the provided WithXyz functions construct.
func NewPubOptions ¶
func NewPubOptions(opts ...PubOption) (options PubOptions, err error)
NewPubOptions constructs an PubOptions struct from the provided PubOption closures and returns it.
type SubOption ¶
type SubOption func(o *SubOptions) error
SubOption is a closure that updates SubOptions.
func WithAtLeastOnceDelivery ¶
func WithAtLeastOnceDelivery() SubOption
Configures delivery semantics of subscription to be at-least-once delivery. If a semantics preference is not set, mq implementation will use its default mode. Mutually exclusive with WithAtMostOnceDelivery()
func WithAtMostOnceDelivery ¶
Configures delivery semantics of subscription to be at-most-once delivery. If a semantics preference is not set, mq implementation will use its default mode. groupId is also optional. Pass in mq.DefaultId to have the mq implementation set a default groupId. Mutually exclusive with WithAtLeastOnceDelivery()
func WithDecoder ¶
func WithDecoder(decoder Decoder, vPtrFactory ValuePtrFactory) SubOption
Use WithDecoder to decode a message's data payload into a value pointer, which is generated by passed-in ValuePtrFactory. Note: When using the WithDecoder option, Message data is only available via VPtr(). No data will be found in Data().
type SubOptions ¶
type SubOptions struct { Decoder Decoder VPtrFactory ValuePtrFactory DeliverySemantics common.DeliverySemantics GroupId string }
SubOptions contains all the various options that the provided WithXyz functions construct.
func NewSubOptions ¶
func NewSubOptions(opts ...SubOption) (options SubOptions, err error)
NewSubOptions constructs an SubOptions struct from the provided SubOption closures and returns it.
type SubResponseHandler ¶
type SubResponseHandler = func(msg Message, err error) common.ConsumptionCode
type Subscription ¶
type ValuePtrFactory ¶
type ValuePtrFactory interface {
NewVPtr() (vPtr any)
}
ValuePtrFactory is used during optional subscription decoding. A ValuePtrFactory produces the value pointer populated by Decode()