Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoStore = errors.New("result store not found within batch context")
ErrNoStore is an error returned by components attempting to write a message batch to a ResultStore but are unable to locate the store within the batch context.
Functions ¶
This section is empty.
Types ¶
type ResultStore ¶
type ResultStore interface {
// Add a message to the store. The message will be deep copied and have its
// context wiped before storing, and is therefore safe to add even when
// ownership of the message is about to be yielded.
Add(msg types.Message)
// Get the stored slice of messages.
Get() []types.Message
// Clear any currently stored messages.
Clear()
}
ResultStore is a type designed to be propagated along with a message as a way for an output destination to store the final version of the message payload as it saw it.
It is intended that this structure is placed within a message via an attached context, usually under the key 'result_store'.
func NewResultStore ¶
func NewResultStore() ResultStore
NewResultStore returns an implementation of ResultStore.
type ResultStoreKeyType ¶
type ResultStoreKeyType int
ResultStoreKeyType is the recommended type of a context key for adding ResultStores to a message context.
const ResultStoreKey ResultStoreKeyType = iota
ResultStoreKey is the recommended key value for adding ResultStores to a message context.
type RoundTripReader ¶ added in v0.4.1
type RoundTripReader struct {
// contains filtered or unexported fields
}
RoundTripReader is a reader implementation that allows you to define a closure for producing messages and another for processing the result.
The mechanism for receiving results is implemented using a ResultStore, and therefore is subject to pipelines that preserve context and one or more outputs destinations storing their results.
func NewRoundTripReader ¶ added in v0.4.1
func NewRoundTripReader( read func() (types.Message, error), processResults func([]types.Message, error), ) *RoundTripReader
NewRoundTripReader returns a RoundTripReader.
func (*RoundTripReader) Acknowledge ¶ added in v0.4.1
func (f *RoundTripReader) Acknowledge(err error) error
Acknowledge is a noop.
func (*RoundTripReader) CloseAsync ¶ added in v0.4.1
func (f *RoundTripReader) CloseAsync()
CloseAsync is a noop.
func (*RoundTripReader) Connect ¶ added in v0.4.1
func (f *RoundTripReader) Connect() error
Connect is a noop.
func (*RoundTripReader) Read ¶ added in v0.4.1
func (f *RoundTripReader) Read() (types.Message, error)
Read returns a message result from the provided closure.
func (*RoundTripReader) WaitForClose ¶ added in v0.4.1
func (f *RoundTripReader) WaitForClose(time.Duration) error
WaitForClose is a noop.
type StoreWriter ¶
type StoreWriter struct{}
StoreWriter is a writer implementation that adds messages to a ResultStore located in the context of the first message part of each batch.
func (StoreWriter) WaitForClose ¶
func (s StoreWriter) WaitForClose(time.Duration) error
WaitForClose is a noop.