CachedMessageSubscriptionRequest provides an interface through which cache request configurations can be constructed. These configurations can then be passed to a call to a solace.dev/go/messaging/pkg/solace.ReceiverCacheRequests interface method to request cached data. Refer to each of the below factory methods for details on what configuration they provide.
type CachedMessageSubscriptionRequest interface { // GetName retrieves the name of the topic subscription. GetName() string // GetCacheName retrieves the name of the cache. GetCacheName() string // GetCacheAccessTimeout retrieves the timeout for the cache request. GetCacheAccessTimeout() int32 // GetMaxCachedMessages retrieves the max number of cached messages to be retrieved in a request. GetMaxCachedMessages() int32 // GetCachedMessageAge retrieves the max age of cached messages to be retrieved in a request. GetCachedMessageAge() int32 // GetCachedMessageSubscriptionRequestStrategy retrieves the configured type of subscription strategy. GetCachedMessageSubscriptionRequestStrategy() *CachedMessageSubscriptionStrategy }
func NewCachedMessageSubscriptionRequest(cachedMessageSubscriptionStrategy CachedMessageSubscriptionStrategy, cacheName string, subscription *TopicSubscription, cacheAccessTimeout int32, maxCachedMessages int32, cachedMessageAge int32) CachedMessageSubscriptionRequest
NewCachedMessageSubscriptionRequest returns a CachedMessageSubscriptionRequest that can be used to configure a cache request. The cachedMessageSubscriptionStrategy indicates how the API should pass received cached/live messages to the application after a cache request has been sent. Refer to solace.dev/go/messaging/pkg/solace/resource.CachedMessageSubscriptionStrategy for details on what behaviour each strategy configures.
The construction of NewCachedMessageSubscriptionRequest does not validate these parameter values. Instead, they are validated when the cache request is sent after a call to a solace.dev/go/messaging/pkg/solace.ReceiverCacheRequests interface method.
CachedMessageSubscriptionStrategy indicates how the API should pass received cached and live messages to the application. Refer to each variant for details on what behaviour they configure.
type CachedMessageSubscriptionStrategy int
const ( // CacheRequestStrategyAsAvailable provides a configuration for receiving a concurrent mix of both live and cached messages on the given TopicSubscription. CacheRequestStrategyAsAvailable CachedMessageSubscriptionStrategy = iota // CacheRequestStrategyLiveCancelsCached provides a configuration for initially passing received cached messages to the application and as soon as live // messages are received, passing those instead and passing no more cached messages. CacheRequestStrategyLiveCancelsCached // CacheRequestStrategyCachedFirst provides a configuration for passing only cached messages to the application, before passing the received live messages. // The live messages passed to the application thereof this configuration can be received as early as when the cache request is sent // by the API, and are enqueued until the cache response is received and its associated cached messages, if available, are passed to // the application. CacheRequestStrategyCachedFirst // CachedOnly provides a configuration for passing only cached messages and no live messages to the application. // // Note: Cache requests configured using CacheRequestStrategyCachedOnly are limited to be used with subscribers // without live data subscriptions. When used with matching live data subscriptions, cached messages will be // delivered for both the cache outcome and live subscription leading to duplicate message delivery. When needing // cache data when live data subscriptions are already present, it is recommended to use other // CachedMessageSubscriptionStrategy types such as CacheRequestStrategyLiveCancelsCached or // CacheRequestStrategyAsAvailable. CacheRequestStrategyCachedOnly )
Destination represents a message destination on a broker. Some examples of destinations include queues and topics. Destination implementations can be retrieved by the various helper functions, such as TopicOf, QueueDurableExclusive, and TopicSubscriptionOf.
type Destination interface { // GetName retrieves the name of the destination GetName() string }
Queue represents a queue used for guaranteed messaging receivers.
type Queue struct {
// contains filtered or unexported fields
}
func QueueDurableExclusive(queueName string) *Queue
QueueDurableExclusive creates a new durable, exclusive queue with the specified name.
func QueueDurableNonExclusive(queueName string) *Queue
QueueDurableNonExclusive creates a durable, non-exclusive queue with the specified name.
func QueueNonDurableExclusive(queueName string) *Queue
QueueNonDurableExclusive creates an exclusive, non-durable queue with the specified name.
func QueueNonDurableExclusiveAnonymous() *Queue
QueueNonDurableExclusiveAnonymous creates an anonymous, exclusive, and non-durable queue.
func (q *Queue) GetName() string
GetName returns the name of the queue. Implements the Destination interface.
func (q *Queue) IsDurable() bool
IsDurable determines if the Queue is durable. Durable queues are privisioned objects on the broker that have a lifespan that is independent of any one client session.
func (q *Queue) IsExclusivelyAccessible() bool
IsExclusivelyAccessible determines if Queue supports exclusive or shared-access mode. Returns true if the Queue can serve only one consumer at any one time, false if the Queue can serve multiple consumers with each consumer serviced in a round-robin fashion.
func (q *Queue) String() string
ShareName is an interface for identifiers that are associated with a shared subscription. See https://docs.solace.com/PubSub-Basics/Direct-Messages.htm#Shared in the Solace documentation.
type ShareName struct {
// contains filtered or unexported fields
}
func ShareNameOf(name string) *ShareName
ShareNameOf returns a new share name with the provided name. Valid share names are not empty and do not contain special characters '>' or '*'. Returns a new ShareName with the given string.
func (sn *ShareName) GetName() string
GetName returns the share name. Implements the Destination interface.
func (sn *ShareName) String() string
String implements fmt.Stringer
Subscription represents the valid subscriptions that can be specified to receivers. Valid subscriptions include *resource.TopicSubscription.
type Subscription interface { Destination // GetSubscriptionType will return the type of the subscription as a string GetSubscriptionType() string }
Topic is an implementation of destination representing a topic that can be published to.
type Topic struct {
// contains filtered or unexported fields
}
func TopicOf(expression string) *Topic
TopicOf creates a new topic with the specified name. Topic name must not be empty.
func (t *Topic) GetName() string
GetName returns the name of the topic. Implements the Destination interface.
func (t *Topic) String() string
String implements fmt.Stringer
TopicSubscription is a subscription to a topic often used for receivers.
type TopicSubscription struct {
// contains filtered or unexported fields
}
func TopicSubscriptionOf(topic string) *TopicSubscription
TopicSubscriptionOf creates a TopicSubscription of the specified topic string.
func (t *TopicSubscription) GetName() string
GetName returns the topic subscription expression. Implements the Destination interface.
func (t *TopicSubscription) GetSubscriptionType() string
GetSubscriptionType returns the type of the topic subscription as a string
func (t *TopicSubscription) String() string
String implements fmt.Stringer