Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client[Req transport.Request, Res any] struct { Codec transport.OutboundCodec[Req, Res] Transport transport.RoundTripper[Req, Res] Listeners []EventListener }
func New ¶
func New[Req transport.Request, Res any](transport transport.RoundTripper[Req, Res], codec transport.OutboundCodec[Req, Res]) *Client[Req, Res]
func (*Client[Req, Res]) Execute ¶
Execute sends a single invocation and returns the receipt for its task. It is a batch of one; see Client.ExecuteBatch.
func (*Client[Req, Res]) ExecuteBatch ¶
ExecuteBatch sends every invocation in the request in one round trip and returns their receipts. The response is an error if the executor did not answer one of the invocations.
type EventListener ¶
type EventListener interface {
RequestEncodeListener
ResponseDecodeListener
}
EventListener observes both halves of the request/response round trip a client performs: a request being encoded and a response being decoded. Register one with WithEventListener.
type HTTPClient ¶
func NewHTTP ¶
func NewHTTP(serviceURL *url.URL, options ...HTTPOption) (*HTTPClient, error)
func (*HTTPClient) ExecuteBatch ¶
type HTTPOption ¶
type HTTPOption func(*httpClientConfig)
func WithEventListener ¶
func WithEventListener(listener EventListener) HTTPOption
WithEventListener registers an EventListener to observe the client's requests and responses as they are encoded and decoded.
func WithHTTPClient ¶
func WithHTTPClient(client *http.Client) HTTPOption
func WithHTTPCodec ¶
func WithHTTPCodec(codec transport.OutboundCodec[*http.Request, *http.Response]) HTTPOption