client

package
v1.27.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: Apache-2.0 Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advice

type Advice struct {
	Reconnect string `json:"reconnect,omitempty"`
	Timeout   int    `json:"timeout,omitempty"`
	Interval  int    `json:"interval,omitempty"`
}

Advice reusable structure for Bayeux protocol

type Bayeux

type Bayeux interface {
	Start(ctx context.Context) error
}

Bayeux client runner

func NewBayeux

func NewBayeux(apiVersion string, subscriptions []Subscription, authenticator auth.Authenticator, dispatcher EventDispatcher, client *http.Client, logger *zap.SugaredLogger) Bayeux

NewBayeux creates a Bayeux client for Salesforce Streaming API consumption.

type ChangeDataCapturePayload

type ChangeDataCapturePayload struct {
	ChangeEventHeader struct {
		EntityName string
		ChangeType string
	} `json:"ChangeEventHeader"`
}

ChangeDataCapturePayload is a partial structure of the CDC message that the adapter needs to figure out the subject for the CloudEvent.

type CommonResponse

type CommonResponse struct {
	Channel    string `json:"channel"`
	ClientID   string `json:"clientId"`
	Successful bool   `json:"successful"`
	Error      string `json:"error,omitempty"`
}

CommonResponse for all structures at Bayeux protocol.

type ConnectResponse

type ConnectResponse struct {
	CommonResponse `json:",inline"`
	Data           struct {
		Event struct {
			CreatedDate time.Time `json:"createdDate,omitempty"`
			ReplayID    int64     `json:"replayId,omitempty"`
			Type        string    `json:"type,omitempty"`
		} `json:"event,omitempty"`
		Schema  string          `json:"schema,omitempty"`
		SObject json.RawMessage `json:"sobject,omitempty"`
		Payload json.RawMessage `json:"payload,omitempty"`
	} `json:"data,omitempty"`
	Advice Advice `json:"advice,omitempty"`
}

ConnectResponse for Bayeux protocol

type ConnectResponseCallback

type ConnectResponseCallback func(msg *ConnectResponse)

ConnectResponseCallback is the signature for callback functions that handle connect responses that contain data.

type EventDispatcher

type EventDispatcher interface {
	DispatchEvent(context.Context, *ConnectResponse)
	DispatchError(error)
}

EventDispatcher is an object that can dispatch messages and "non managed" errors received through the stream.

type HandshakeResponse

type HandshakeResponse struct {
	CommonResponse           `json:",inline"`
	Version                  string
	MinimumVersion           string
	SupportedConnectionTypes []string
	Advice                   Advice          `json:"advice,omitempty"`
	Extension                json.RawMessage `json:"ext,omitempty"`
}

HandshakeResponse for Bayeux protocol.

type PushTopicSObject

type PushTopicSObject struct {
	Name string `json:"entityName"`
}

PushTopicSObject is a partial structure of the PushTopic message that the adapter needs to figure out the subject for the CloudEvent.

type Subscription

type Subscription struct {
	Channel  string
	ReplayID int
}

Subscription contains data about the channel and replayID for the subscription. For replayID can be:

-2 for all past (stored) and new events.
-1 for new events only.
replayID for receiving events after that replayID event.

See: https://developer.salesforce.com/docs/atlas.en-us.api_streaming.meta/api_streaming/using_streaming_api_durability.htm

type SubscriptionResponse

type SubscriptionResponse struct {
	CommonResponse `json:",inline"`
	Subscription   string `json:"subscription,omitempty"`
	Advice         Advice `json:"advice,omitempty"`
}

SubscriptionResponse for Bayeux protocol

Jump to

Keyboard shortcuts

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