core

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package core abstracts out the inner workings of CCSMP and provides a few key entities used by various other services. For example, it contains SolClientTransport which wraps the session and context, as well as SolClientPublisher which wraps the session and provides hooks for callbacks. SolClient structs are not responsible for state tracking.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetVersion

func GetVersion() (version, buildTime, variant string)

GetVersion function

func SetLogLevel

func SetLogLevel(level logging.LogLevel)

SetLogLevel function

func SetNativeLogLevel

func SetNativeLogLevel(level logging.LogLevel)

SetNativeLogLevel function

func SetVersion

func SetVersion(defaultVersion string)

SetVersion function

func ToNativeError

func ToNativeError(err ErrorInfo, args ...string) error

ToNativeError wrapps the ErrorInfo in a solace.NativeError with a prefix string if provided.

Types

type AcknowledgementHandler

type AcknowledgementHandler func(correlationMsgId uint64, persisted bool, err error)

AcknowledgementHandler defined

type Acknowledgements

type Acknowledgements interface {
	// Registers a callback for correlation
	AddAcknowledgementHandler(ackHandler AcknowledgementHandler) (uint64, func() (messageId uint64, correlationTag []byte))
	// Deregisters the callback for correlation
	RemoveAcknowledgementHandler(pubID uint64)
}

Acknowledgements interface

type ErrorInfo

type ErrorInfo = *ccsmp.SolClientErrorInfoWrapper

ErrorInfo reexports *ccsmp.SolClientErrorInfoWrapper. In all cases, core.ErrorInfo should be used instead of *ccsmp.SolClientErrorInfoWrapper

type Event

type Event int

Event type defined

const (

	// SolClientEventUp represents ccsmp.SolClientSessionEventUpNotice in sessionEventMapping
	SolClientEventUp Event = iota

	// SolClientEventDown represents SolClientSessionEventDownError in sessionEventMapping
	SolClientEventDown

	// SolClientEventCanSend represents ccsmp.SolClientSessionEventCanSend in sessionEventMapping
	SolClientEventCanSend

	// SolClientEventAcknowledgement represents ccsmp.SolClientSessionEventAcknowledgement in sessionEventMapping
	SolClientEventAcknowledgement

	// SolClientEventRejected represents ccsmp.SolClientSessionEventRejectedMsgError in sessionEventMapping
	SolClientEventRejected

	// SolClientEventReconnect represents ccsmp.SolClientSessionEventReconnectedNotice in sessionEventMapping
	SolClientEventReconnect

	// SolClientEventReconnectAttempt represents ccsmp.SolClientSessionEventReconnectingNotice in sessionEventMapping
	SolClientEventReconnectAttempt

	// SolClientSubscriptionOk represents ccsmp.SolClientSessionEventSubscriptionOk in sessionEventMapping
	SolClientSubscriptionOk

	// SolClientSubscriptionError represents ccsmp.SolClientSessionEventSubscriptionError in sessionEventMapping
	SolClientSubscriptionError
)

type EventHandler

type EventHandler func(SessionEventInfo)

EventHandler type defined

type EventInfo

type EventInfo interface {
	GetError() error
	GetInfoString() string
}

EventInfo interface defined

type Events

type Events interface {
	AddEventHandler(sessionEvent Event, responseCode EventHandler) uint
	RemoveEventHandler(id uint)
}

Events interface defined

type FlowEventInfo

type FlowEventInfo interface {
	EventInfo
}

FlowEventInfo interface

type MessageID

type MessageID = ccsmp.SolClientMessageID

MessageID type defined

type Metrics

type Metrics interface {
	GetStat(metric metrics.Metric) uint64
	IncrementMetric(metric NextGenMetric, amount uint64)
	ResetStats()
}

Metrics interface

type NextGenMetric

type NextGenMetric int

NextGenMetric structure

const (
	// MetricReceivedMessagesTerminationDiscarded initialized
	MetricReceivedMessagesTerminationDiscarded NextGenMetric = iota

	// MetricReceivedMessagesBackpressureDiscarded initialized
	MetricReceivedMessagesBackpressureDiscarded NextGenMetric = iota

	// MetricPublishMessagesTerminationDiscarded initialized
	MetricPublishMessagesTerminationDiscarded NextGenMetric = iota

	// MetricPublishMessagesBackpressureDiscarded initialized
	MetricPublishMessagesBackpressureDiscarded NextGenMetric = iota

	// MetricInternalDiscardNotifications initialized
	MetricInternalDiscardNotifications NextGenMetric = iota
)

type PersistentEventCallback

type PersistentEventCallback func(event ccsmp.SolClientFlowEvent, eventInfo FlowEventInfo)

PersistentEventCallback type defined

type PersistentReceiver

type PersistentReceiver interface {
	// Destroy destroys the flow
	Destroy(freeMemory bool) ErrorInfo
	// Start will start the receiption of messages
	// Persistent Receivers are started by default after creation
	Start() ErrorInfo
	// Stop will stop the reception of messages
	Stop() ErrorInfo
	// Subscribe will add a subscription to the persistent receiver
	Subscribe(topic string) (SubscriptionCorrelationID, <-chan SubscriptionEvent, ErrorInfo)
	// Unsubscribe will remove the subscription from the persistent receiver
	Unsubscribe(topic string) (SubscriptionCorrelationID, <-chan SubscriptionEvent, ErrorInfo)
	// Ack will acknowledge the given message
	Ack(msgID MessageID) ErrorInfo
	// Destionation returns the destination if retrievable, or an error if one occurred
	Destination() (destination string, durable bool, errorInfo ErrorInfo)
}

PersistentReceiver interface

type Publishable

type Publishable = ccsmp.SolClientMessagePt

Publishable defined

type Publisher

type Publisher interface {
	// Publish pulishes a message in the form of a SolClientPublishable. Returns any error info from underlying send.
	Publish(message Publishable) ErrorInfo
	// Events returns SolClientEvents
	Events() Events
	// AwaitWritable awaits a writable message. Throws an error if interrupted for termination
	AwaitWritable(terminateSignal chan struct{}) error
	// TaskQueue gets the task queue that can be used to push tasks
	// TaskQueue may be a 0 length queue such that each task is transactioned, ie. no tasks sit in flux
	TaskQueue() chan SendTask
	// checks if the internal publisher is running
	IsRunning() bool
	// Increments a core metric
	IncrementMetric(metric NextGenMetric, amount uint64)
	// Acknowledgements returns the acknowledgement handler
	Acknowledgements() Acknowledgements
}

Publisher interface

type Receivable

type Receivable = ccsmp.SolClientMessagePt

Receivable type defined

type Receiver

type Receiver interface {
	// checks if the internal receiver is running
	IsRunning() bool
	// Events returns SolClientEvents
	Events() Events
	// Register an RX callback, returns a correlation pointer used when adding and removing subscriptions
	RegisterRXCallback(msgCallback RxCallback) uintptr
	// Remove the callback allowing GC to cleanup the function registered
	UnregisterRXCallback(ptr uintptr)
	// Add a subscription to the given correlation pointer
	Subscribe(topic string, ptr uintptr) (SubscriptionCorrelationID, <-chan SubscriptionEvent, ErrorInfo)
	// Remove a subscription from the given correlation pointer
	Unsubscribe(topic string, ptr uintptr) (SubscriptionCorrelationID, <-chan SubscriptionEvent, ErrorInfo)
	// Clears the subscription correlation with the given ID
	ClearSubscriptionCorrelation(id SubscriptionCorrelationID)
	// ProvisionEndpoint will provision an endpoint
	ProvisionEndpoint(queueName string, isExclusive bool) ErrorInfo
	// EndpointUnsubscribe will call endpoint unsubscribe on the endpoint
	EndpointUnsubscribe(queueName string, topic string) (SubscriptionCorrelationID, <-chan SubscriptionEvent, ErrorInfo)
	// Increments receiver metrics
	IncrementMetric(metric NextGenMetric, amount uint64)
	// Creates a new persistent receiver with the given callback
	NewPersistentReceiver(properties []string, callback RxCallback, eventCallback PersistentEventCallback) (PersistentReceiver, ErrorInfo)
}

Receiver interface

type RxCallback

type RxCallback func(msg Receivable) bool

RxCallback type defined

type SendTask

type SendTask func()

SendTask defined

type SessionEventInfo

type SessionEventInfo interface {
	EventInfo
	GetCorrelationPointer() unsafe.Pointer
}

SessionEventInfo interface defined

type SubscriptionCorrelationID

type SubscriptionCorrelationID = uintptr

SubscriptionCorrelationID defined

type SubscriptionEvent

type SubscriptionEvent interface {
	GetID() SubscriptionCorrelationID
	GetError() error
}

SubscriptionEvent is the event passed to a channel on completion of a subscription

type Transport

type Transport interface {
	Connect() error
	Disconnect() error
	Close() error
	Publisher() Publisher
	Receiver() Receiver
	Metrics() Metrics
	Events() Events
	ID() string
	Host() string
}

Transport interface

func NewTransport

func NewTransport(host string, properties []string) (Transport, error)

NewTransport function

Jump to

Keyboard shortcuts

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