Skip to content

New Client interface.

Pre-release
Pre-release
Compare
Choose a tag to compare
@n3wscott n3wscott released this 16 Mar 19:20
3e150c4

In preview2 we are focusing on the new Client interface:

type Client interface {
	Send(ctx context.Context, event event.Event) error
	Request(ctx context.Context, event event.Event) (*event.Event, error)
	StartReceiver(ctx context.Context, fn interface{}) error
}

Where a full fn looks like
func(context.Context, event.Event) (*event.Event, transport.Result)

For protocols that do not support responses, StartReceiver will throw an error
when attempting to set a receiver fn with that capability.

For protocols that do not support responses from send (Requester interface),
Client.Request will throw an error.

Other things to note:

  • Transport has been renamed to Protocol.
  • Codec is dropped.
  • Direct HTTP handlers are now supported with helpers to convert to event.Event see the example.