Documentation
¶
Index ¶
- Constants
- type Client
- func (c *Client) Acknowledge(ctx context.Context, project string, subscription string, ackIds []string, ...) error
- func (c *Client) Publish(ctx context.Context, project string, topic string, ...) (*publish_response.Response, error)
- func (c *Client) Pull(ctx context.Context, project string, subscription string, maxMessages int, ...) (*pull_response.Response, error)
Constants ¶
const Domain = "pubsub.googleapis.com"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(options ...pubsub_config.Option) *Client
func (*Client) Acknowledge ¶ added in v1.49.0
func (c *Client) Acknowledge( ctx context.Context, project string, subscription string, ackIds []string, options ...fetch_config.Option, ) error
Acknowledge tells the server that the given messages have been dealt with, so that they are not delivered again. Acknowledging nothing is not a request.
func (*Client) Publish ¶
func (c *Client) Publish( ctx context.Context, project string, topic string, request *publish_request.Request, options ...fetch_config.Option, ) (*publish_response.Response, error)
Publish publishes the messages in the request to the given topic and returns the server-assigned message ids. The runtime identity must have the pubsub.publisher role on the topic.
func (*Client) Pull ¶ added in v1.49.0
func (c *Client) Pull( ctx context.Context, project string, subscription string, maxMessages int, options ...fetch_config.Option, ) (*pull_response.Response, error)
Pull asks for whatever is waiting on a subscription. The runtime identity must have the pubsub.subscriber role on it.
Nothing is acknowledged. That is the caller's to decide and it is the decision that matters: a message stays outstanding until acknowledged and is delivered again if the deadline passes, so acknowledging before the work is done trades duplicates for loss. Which way to trade depends on what the message carries. A signal that something should be refreshed can be acknowledged at once, because whoever wanted the refresh will ask again; a log line cannot, because nothing will ever ask for it again. Consumers of the second kind acknowledge after the message is somewhere durable, and rely on being able to recognise a duplicate.
An empty response is the ordinary idle case, not a failure: the server waits a short while for messages and then answers with none.