client

package
v0.1.38 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

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, url string, subscriptions []Subscription, 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