Documentation
¶
Overview ¶
Package messagingapi implements the public API of the messaging.example microservice, including clients and data structures.
The Messaging microservice demonstrates service-to-service communication patterns.
Index ¶
- Constants
- Variables
- type Client
- func (_c *Client) CacheLoad(r *http.Request) (res *http.Response, err error)
- func (_c *Client) CacheLoad_Get(ctx context.Context, url string) (res *http.Response, err error)
- func (_c *Client) CacheLoad_Post(ctx context.Context, url string, contentType string, body any) (res *http.Response, err error)
- func (_c *Client) CacheStore(r *http.Request) (res *http.Response, err error)
- func (_c *Client) CacheStore_Get(ctx context.Context, url string) (res *http.Response, err error)
- func (_c *Client) CacheStore_Post(ctx context.Context, url string, contentType string, body any) (res *http.Response, err error)
- func (_c *Client) DefaultQueue(r *http.Request) (res *http.Response, err error)
- func (_c *Client) DefaultQueue_Get(ctx context.Context, url string) (res *http.Response, err error)
- func (_c *Client) DefaultQueue_Post(ctx context.Context, url string, contentType string, body any) (res *http.Response, err error)
- func (_c *Client) ForHost(host string) *Client
- func (_c *Client) Home(r *http.Request) (res *http.Response, err error)
- func (_c *Client) Home_Get(ctx context.Context, url string) (res *http.Response, err error)
- func (_c *Client) Home_Post(ctx context.Context, url string, contentType string, body any) (res *http.Response, err error)
- func (_c *Client) NoQueue(r *http.Request) (res *http.Response, err error)
- func (_c *Client) NoQueue_Get(ctx context.Context, url string) (res *http.Response, err error)
- func (_c *Client) NoQueue_Post(ctx context.Context, url string, contentType string, body any) (res *http.Response, err error)
- func (_c *Client) WithOptions(opts ...pub.Option) *Client
- type MulticastClient
- func (_c *MulticastClient) CacheLoad(ctx context.Context, r *http.Request) <-chan *pub.Response
- func (_c *MulticastClient) CacheLoad_Get(ctx context.Context, url string) <-chan *pub.Response
- func (_c *MulticastClient) CacheLoad_Post(ctx context.Context, url string, contentType string, body any) <-chan *pub.Response
- func (_c *MulticastClient) CacheStore(ctx context.Context, r *http.Request) <-chan *pub.Response
- func (_c *MulticastClient) CacheStore_Get(ctx context.Context, url string) <-chan *pub.Response
- func (_c *MulticastClient) CacheStore_Post(ctx context.Context, url string, contentType string, body any) <-chan *pub.Response
- func (_c *MulticastClient) DefaultQueue(ctx context.Context, r *http.Request) <-chan *pub.Response
- func (_c *MulticastClient) DefaultQueue_Get(ctx context.Context, url string) <-chan *pub.Response
- func (_c *MulticastClient) DefaultQueue_Post(ctx context.Context, url string, contentType string, body any) <-chan *pub.Response
- func (_c *MulticastClient) ForHost(host string) *MulticastClient
- func (_c *MulticastClient) Home(ctx context.Context, r *http.Request) <-chan *pub.Response
- func (_c *MulticastClient) Home_Get(ctx context.Context, url string) <-chan *pub.Response
- func (_c *MulticastClient) Home_Post(ctx context.Context, url string, contentType string, body any) <-chan *pub.Response
- func (_c *MulticastClient) NoQueue(ctx context.Context, r *http.Request) <-chan *pub.Response
- func (_c *MulticastClient) NoQueue_Get(ctx context.Context, url string) <-chan *pub.Response
- func (_c *MulticastClient) NoQueue_Post(ctx context.Context, url string, contentType string, body any) <-chan *pub.Response
- func (_c *MulticastClient) WithOptions(opts ...pub.Option) *MulticastClient
Constants ¶
const Hostname = "messaging.example"
Hostname is the default hostname of the microservice: messaging.example.
Variables ¶
var ( URLOfHome = httpx.JoinHostAndPath(Hostname, `:443/home`) URLOfNoQueue = httpx.JoinHostAndPath(Hostname, `:443/no-queue`) URLOfDefaultQueue = httpx.JoinHostAndPath(Hostname, `:443/default-queue`) URLOfCacheLoad = httpx.JoinHostAndPath(Hostname, `:443/cache-load`) URLOfCacheStore = httpx.JoinHostAndPath(Hostname, `:443/cache-store`) )
Fully-qualified URLs of the microservice's endpoints.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an interface to calling the endpoints of the messaging.example microservice. This simple version is for unicast calls.
func (*Client) CacheLoad ¶
CacheLoad looks up an element in the distributed cache of the microservice.
If a request is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint.
func (*Client) CacheLoad_Get ¶
CacheLoad_Get performs a GET request to the CacheLoad endpoint.
CacheLoad looks up an element in the distributed cache of the microservice.
If a URL is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint.
func (*Client) CacheLoad_Post ¶
func (_c *Client) CacheLoad_Post(ctx context.Context, url string, contentType string, body any) (res *http.Response, err error)
CacheLoad_Post performs a POST request to the CacheLoad endpoint.
CacheLoad looks up an element in the distributed cache of the microservice.
If a URL is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint. If the body if of type io.Reader, []byte or string, it is serialized in binary form. If it is of type url.Values, it is serialized as form data. All other types are serialized as JSON. If a content type is not explicitly provided, an attempt will be made to derive it from the body.
func (*Client) CacheStore ¶
CacheStore stores an element in the distributed cache of the microservice.
If a request is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint.
func (*Client) CacheStore_Get ¶
CacheStore_Get performs a GET request to the CacheStore endpoint.
CacheStore stores an element in the distributed cache of the microservice.
If a URL is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint.
func (*Client) CacheStore_Post ¶
func (_c *Client) CacheStore_Post(ctx context.Context, url string, contentType string, body any) (res *http.Response, err error)
CacheStore_Post performs a POST request to the CacheStore endpoint.
CacheStore stores an element in the distributed cache of the microservice.
If a URL is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint. If the body if of type io.Reader, []byte or string, it is serialized in binary form. If it is of type url.Values, it is serialized as form data. All other types are serialized as JSON. If a content type is not explicitly provided, an attempt will be made to derive it from the body.
func (*Client) DefaultQueue ¶
DefaultQueue demonstrates how the DefaultQueue subscription option is used to create a unicast request/response communication pattern. Only one of the instances of this microservice will respond to each request.
If a request is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint.
func (*Client) DefaultQueue_Get ¶
DefaultQueue_Get performs a GET request to the DefaultQueue endpoint.
DefaultQueue demonstrates how the DefaultQueue subscription option is used to create a unicast request/response communication pattern. Only one of the instances of this microservice will respond to each request.
If a URL is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint.
func (*Client) DefaultQueue_Post ¶
func (_c *Client) DefaultQueue_Post(ctx context.Context, url string, contentType string, body any) (res *http.Response, err error)
DefaultQueue_Post performs a POST request to the DefaultQueue endpoint.
DefaultQueue demonstrates how the DefaultQueue subscription option is used to create a unicast request/response communication pattern. Only one of the instances of this microservice will respond to each request.
If a URL is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint. If the body if of type io.Reader, []byte or string, it is serialized in binary form. If it is of type url.Values, it is serialized as form data. All other types are serialized as JSON. If a content type is not explicitly provided, an attempt will be made to derive it from the body.
func (*Client) Home ¶
Home demonstrates making requests using multicast and unicast request/response patterns.
If a request is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint.
func (*Client) Home_Get ¶
Home_Get performs a GET request to the Home endpoint.
Home demonstrates making requests using multicast and unicast request/response patterns.
If a URL is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint.
func (*Client) Home_Post ¶
func (_c *Client) Home_Post(ctx context.Context, url string, contentType string, body any) (res *http.Response, err error)
Home_Post performs a POST request to the Home endpoint.
Home demonstrates making requests using multicast and unicast request/response patterns.
If a URL is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint. If the body if of type io.Reader, []byte or string, it is serialized in binary form. If it is of type url.Values, it is serialized as form data. All other types are serialized as JSON. If a content type is not explicitly provided, an attempt will be made to derive it from the body.
func (*Client) NoQueue ¶
NoQueue demonstrates how the NoQueue subscription option is used to create a multicast request/response communication pattern. All instances of this microservice will respond to each request.
If a request is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint.
func (*Client) NoQueue_Get ¶
NoQueue_Get performs a GET request to the NoQueue endpoint.
NoQueue demonstrates how the NoQueue subscription option is used to create a multicast request/response communication pattern. All instances of this microservice will respond to each request.
If a URL is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint.
func (*Client) NoQueue_Post ¶
func (_c *Client) NoQueue_Post(ctx context.Context, url string, contentType string, body any) (res *http.Response, err error)
NoQueue_Post performs a POST request to the NoQueue endpoint.
NoQueue demonstrates how the NoQueue subscription option is used to create a multicast request/response communication pattern. All instances of this microservice will respond to each request.
If a URL is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint. If the body if of type io.Reader, []byte or string, it is serialized in binary form. If it is of type url.Values, it is serialized as form data. All other types are serialized as JSON. If a content type is not explicitly provided, an attempt will be made to derive it from the body.
type MulticastClient ¶
type MulticastClient struct {
// contains filtered or unexported fields
}
MulticastClient is an interface to calling the endpoints of the messaging.example microservice. This advanced version is for multicast calls.
func NewMulticastClient ¶
func NewMulticastClient(caller service.Publisher) *MulticastClient
NewMulticastClient creates a new multicast client to the messaging.example microservice.
func (*MulticastClient) CacheLoad ¶
CacheLoad looks up an element in the distributed cache of the microservice.
If a request is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint.
func (*MulticastClient) CacheLoad_Get ¶
CacheLoad_Get performs a GET request to the CacheLoad endpoint.
CacheLoad looks up an element in the distributed cache of the microservice.
If a URL is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint.
func (*MulticastClient) CacheLoad_Post ¶
func (_c *MulticastClient) CacheLoad_Post(ctx context.Context, url string, contentType string, body any) <-chan *pub.Response
CacheLoad_Post performs a POST request to the CacheLoad endpoint.
CacheLoad looks up an element in the distributed cache of the microservice.
If a URL is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint. If the body if of type io.Reader, []byte or string, it is serialized in binary form. If it is of type url.Values, it is serialized as form data. All other types are serialized as JSON. If a content type is not explicitly provided, an attempt will be made to derive it from the body.
func (*MulticastClient) CacheStore ¶
CacheStore stores an element in the distributed cache of the microservice.
If a request is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint.
func (*MulticastClient) CacheStore_Get ¶
CacheStore_Get performs a GET request to the CacheStore endpoint.
CacheStore stores an element in the distributed cache of the microservice.
If a URL is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint.
func (*MulticastClient) CacheStore_Post ¶
func (_c *MulticastClient) CacheStore_Post(ctx context.Context, url string, contentType string, body any) <-chan *pub.Response
CacheStore_Post performs a POST request to the CacheStore endpoint.
CacheStore stores an element in the distributed cache of the microservice.
If a URL is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint. If the body if of type io.Reader, []byte or string, it is serialized in binary form. If it is of type url.Values, it is serialized as form data. All other types are serialized as JSON. If a content type is not explicitly provided, an attempt will be made to derive it from the body.
func (*MulticastClient) DefaultQueue ¶
DefaultQueue demonstrates how the DefaultQueue subscription option is used to create a unicast request/response communication pattern. Only one of the instances of this microservice will respond to each request.
If a request is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint.
func (*MulticastClient) DefaultQueue_Get ¶
DefaultQueue_Get performs a GET request to the DefaultQueue endpoint.
DefaultQueue demonstrates how the DefaultQueue subscription option is used to create a unicast request/response communication pattern. Only one of the instances of this microservice will respond to each request.
If a URL is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint.
func (*MulticastClient) DefaultQueue_Post ¶
func (_c *MulticastClient) DefaultQueue_Post(ctx context.Context, url string, contentType string, body any) <-chan *pub.Response
DefaultQueue_Post performs a POST request to the DefaultQueue endpoint.
DefaultQueue demonstrates how the DefaultQueue subscription option is used to create a unicast request/response communication pattern. Only one of the instances of this microservice will respond to each request.
If a URL is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint. If the body if of type io.Reader, []byte or string, it is serialized in binary form. If it is of type url.Values, it is serialized as form data. All other types are serialized as JSON. If a content type is not explicitly provided, an attempt will be made to derive it from the body.
func (*MulticastClient) ForHost ¶
func (_c *MulticastClient) ForHost(host string) *MulticastClient
ForHost replaces the default hostname of this client.
func (*MulticastClient) Home ¶
Home demonstrates making requests using multicast and unicast request/response patterns.
If a request is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint.
func (*MulticastClient) Home_Get ¶
Home_Get performs a GET request to the Home endpoint.
Home demonstrates making requests using multicast and unicast request/response patterns.
If a URL is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint.
func (*MulticastClient) Home_Post ¶
func (_c *MulticastClient) Home_Post(ctx context.Context, url string, contentType string, body any) <-chan *pub.Response
Home_Post performs a POST request to the Home endpoint.
Home demonstrates making requests using multicast and unicast request/response patterns.
If a URL is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint. If the body if of type io.Reader, []byte or string, it is serialized in binary form. If it is of type url.Values, it is serialized as form data. All other types are serialized as JSON. If a content type is not explicitly provided, an attempt will be made to derive it from the body.
func (*MulticastClient) NoQueue ¶
NoQueue demonstrates how the NoQueue subscription option is used to create a multicast request/response communication pattern. All instances of this microservice will respond to each request.
If a request is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint.
func (*MulticastClient) NoQueue_Get ¶
NoQueue_Get performs a GET request to the NoQueue endpoint.
NoQueue demonstrates how the NoQueue subscription option is used to create a multicast request/response communication pattern. All instances of this microservice will respond to each request.
If a URL is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint.
func (*MulticastClient) NoQueue_Post ¶
func (_c *MulticastClient) NoQueue_Post(ctx context.Context, url string, contentType string, body any) <-chan *pub.Response
NoQueue_Post performs a POST request to the NoQueue endpoint.
NoQueue demonstrates how the NoQueue subscription option is used to create a multicast request/response communication pattern. All instances of this microservice will respond to each request.
If a URL is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint. If the body if of type io.Reader, []byte or string, it is serialized in binary form. If it is of type url.Values, it is serialized as form data. All other types are serialized as JSON. If a content type is not explicitly provided, an attempt will be made to derive it from the body.
func (*MulticastClient) WithOptions ¶ added in v1.13.1
func (_c *MulticastClient) WithOptions(opts ...pub.Option) *MulticastClient
WithOptions applies options to requests made by this client.