encorecloud

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2023 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package encorecloud contains the abstractions for interacting with Encore Cloud specific services

Index

Constants

View Source
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 NewClient

func NewClient(client *client.Client) *Client

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL