github.com/Jeffail/benthos/v3@v3.65.0/lib/output/writer/interface.go (about)

     1  package writer
     2  
     3  import (
     4  	"github.com/Jeffail/benthos/v3/lib/types"
     5  )
     6  
     7  // Type is a type that writes Benthos messages to a third party sink. If the
     8  // protocol supports a form of acknowledgement then it will be returned by the
     9  // call to Write.
    10  type Type interface {
    11  	// Connect attempts to establish a connection to the sink, if unsuccessful
    12  	// returns an error. If the attempt is successful (or not necessary) returns
    13  	// nil.
    14  	Connect() error
    15  
    16  	// Write should block until either the message is sent (and acknowledged) to
    17  	// a sink, or a transport specific error has occurred, or the Type is
    18  	// closed.
    19  	Write(msg types.Message) error
    20  
    21  	types.Closable
    22  }