Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( DefaultPublisherOption = &PublisherOption{ PublishDelayMessage: false, } DefaultSubscriberOption = &SubscriberOption{ SubscribeDelayMessage: false, } )
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct { // Payload is the message's payload. Payload Payload // contains filtered or unexported fields }
Message is the basic transfer unit. Messages are emitted by Publishers and received by Subscribers.
func NewMessage ¶
NewMessage creates a new Message with payload.
func (*Message) Ack ¶
Ack sends message's acknowledgement.
Ack is not blocking. Ack is idempotent. False is returned, if Nack is already sent.
func (*Message) Acked ¶
func (m *Message) Acked() <-chan struct{}
Acked returns channel which is closed when acknowledgement is sent.
Usage:
select { case <-message.Acked(): // ack received case <-message.Nacked(): // nack received }
func (*Message) Context ¶
Context returns the message's context. To change the context, use SetContext.
The returned context is always non-nil; it defaults to the background context.
func (*Message) Nack ¶
Nack sends message's negative acknowledgement.
Nack is not blocking. Nack is idempotent. False is returned, if Ack is already sent.
func (*Message) Nacked ¶
func (m *Message) Nacked() <-chan struct{}
Nacked returns channel which is closed when negative acknowledgement is sent.
Usage:
select { case <-message.Acked(): // ack received case <-message.Nacked(): // nack received }
func (*Message) SetContext ¶
SetContext sets provided context to the message.
type PublisherOption ¶ added in v2.0.4
type PublisherOption struct {
PublishDelayMessage bool
}
type SubscriberOption ¶ added in v2.0.4
type SubscriberOption struct {
SubscribeDelayMessage bool
}