/
writer.go
36 lines (27 loc) · 918 Bytes
/
writer.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package roundtrip
import (
"time"
"github.com/Jeffail/benthos/v3/lib/types"
)
//------------------------------------------------------------------------------
// Writer is a writer implementation that adds messages to a ResultStore located
// in the context of the first message part of each batch. This is essentially a
// mechanism that returns the result of a pipeline directly back to the origin
// of the message.
type Writer struct{}
// Connect is a noop.
func (s Writer) Connect() error {
return nil
}
// Write a message batch to a ResultStore located in the first message of the
// batch.
func (s Writer) Write(msg types.Message) error {
return SetAsResponse(msg)
}
// CloseAsync is a noop.
func (s Writer) CloseAsync() {}
// WaitForClose is a noop.
func (s Writer) WaitForClose(time.Duration) error {
return nil
}
//------------------------------------------------------------------------------