Documentation ¶
Overview ¶
Package outbox provides an inbound pipeline stage that ensures message idempotence by employing the "outbox pattern".
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Deduplicator ¶
type Deduplicator struct { Repository Repository Next endpoint.InboundPipeline }
Deduplicator is an inbound pipeline stage that provides message idempotency using the "outbox" pattern.
See http://gistlabs.com/2014/05/the-outbox/
func (*Deduplicator) Accept ¶
func (d *Deduplicator) Accept(ctx context.Context, s endpoint.MessageSink, env endpoint.InboundEnvelope) error
Accept passes env to the next pipeline stage only if it has not been processed previously.
If it has been processed previously, the messages that were produced the first time are sent using s.
func (*Deduplicator) Initialize ¶
Initialize is called during initialization of the endpoint, after the transport is initialized. It can be used to inspect or further configure the endpoint as per the needs of the pipeline.
type Repository ¶
type Repository interface { // LoadOutbox loads the unsent outbound messages that were produced when the // message identified by id was first processed. // // ok is false if the message has not yet been successfully processed. LoadOutbox( ctx context.Context, ds persistence.DataStore, id ax.MessageID, ) (envs []endpoint.OutboundEnvelope, ok bool, err error) // SaveOutbox saves a set of unsent outbound messages that were produced // when the message identified by id was processed. SaveOutbox( ctx context.Context, tx persistence.Tx, id ax.MessageID, envs []endpoint.OutboundEnvelope, ) error // MarkAsSent marks a message as sent, removing it from the outbox. MarkAsSent( ctx context.Context, tx persistence.Tx, env endpoint.OutboundEnvelope, ) error }
Repository is an interface for manipulating the outgoing messages that comprise an incoming message's outbox.