Documentation
¶
Overview ¶
Package encorecloud contains the abstractions for interacting with Encore Cloud specific services
Index ¶
Constants ¶
const ( KeepAliveInterval = 5 * time.Second PushVersionAcceptHeader = "X-Encore-Push-Accept-Version" PushVersionHeader = "X-Encore-Push-Version" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the SDK for communicating with the Encore Cloud specific services.
func (*Client) CreateSubscriptionHandler ¶
func (c *Client) CreateSubscriptionHandler(subscriptionID string, logger *zerolog.Logger, callback types.SubscriptionCallback) http.HandlerFunc
CreateSubscriptionHandler returns a http.HandlerFunc that can be used to handle subscription push requests from EncoreCloud.
The handler will call the provided callback function with the message ID and payload and will negotiate the push version with the server, such that Encore Platform will send a list of supported versions and this handler will respond with the highest version it supports. This allows for backwards compatibility with older running applications without requiring them to be updated and redeployed.
The handler will a 406 Not Acceptable error server cannot accept the request due to a newer push version.
func (*Client) PublishToTopic ¶
func (c *Client) PublishToTopic(ctx context.Context, topicID string, orderingKey string, attrs map[string]string, data []byte) (msgID string, err error)
PublishToTopic publishes the specified attrs and data to the topic specified by topicID.
orderingKey should be empty on topics not configured with an OrderingKey, otherwise it should be given a string value. It is used to send messages to FIFO queues grouped using the given ordering key value. i.e. Messages sent with the same ordering key will be delivered to consumers in the order they were sent.
It returns the message ID of the published message from the underlying message broker and any error encountered.