pubsub

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GRPCEndpoint    = "api.pubsub.salesforce.com:7443"
	GRPCDialTimeout = 5 * time.Second
	GRPCCallTimeout = 5 * time.Second

	Appetite int32 = 5
)

Variables

View Source
var ErrUnexpectedType = fmt.Errorf("unexpected type")
View Source
var InvalidReplayIdError = errors.New("Invalid Replay Id")

Functions

func ErrCouldNotConvertType

func ErrCouldNotConvertType(from any, to any) error

func ProcessBitMap

func ProcessBitMap(avroSchema map[string]any, bitmapFields []string) ([]string, error)

ProcessBitMap takes the bitmap-encoded list of changed fields and returns a list of field names. See Salesforce pub-sub docs for more details: https://developer.salesforce.com/docs/platform/pub-sub-api/guide/event-deserialization-considerations.html

func Subscribe

func Subscribe(f *Force, channel string, replayId string, replayPreset proto.ReplayPreset, parseChanges bool) error

Types

type PubSubClient

type PubSubClient struct {
	// contains filtered or unexported fields
}

func NewGRPCClient

func NewGRPCClient(f *Force) (*PubSubClient, error)

Creates a new connection to the gRPC server and returns the wrapper struct

func (*PubSubClient) Close

func (c *PubSubClient) Close()

Closes the underlying connection to the gRPC server

func (*PubSubClient) GetSchema

func (c *PubSubClient) GetSchema(schemaId string) (*proto.SchemaInfo, error)

Wrapper function around the GetSchema RPC. This will add the OAuth credentials and make a call to fetch data about a specific schema

func (*PubSubClient) GetTopic

func (c *PubSubClient) GetTopic(channel string) (*proto.TopicInfo, error)

Wrapper function around the GetTopic RPC. This will add the OAuth credentials and make a call to fetch data about a specific topic

func (*PubSubClient) Subscribe

func (c *PubSubClient) Subscribe(channel string, replayPreset proto.ReplayPreset, replayId []byte, changesOnly bool) ([]byte, error)

Wrapper function around the Subscribe RPC. This will add the OAuth credentials and create a separate streaming client that will be used to fetch data from the topic. This method will continuously consume messages unless an error occurs; if an error does occur then this method will return the last successfully consumed ReplayId as well as the error message. If no messages were successfully consumed then this method will return the same ReplayId that it originally received as a parameter

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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