Skip to content

Commit

Permalink
Merge pull request #102 from SolaceDev/EBP-567
Browse files Browse the repository at this point in the history
EBP-567: Update Cache Request Strategy Names
  • Loading branch information
TrentDaniel authored Feb 19, 2025
2 parents 52832c2 + bd2844c commit a533d12
Show file tree
Hide file tree
Showing 6 changed files with 189 additions and 189 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-20.04
#Steps for the compatiblity test
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup Go Environment
uses: actions/setup-go@v4
with:
Expand Down Expand Up @@ -39,7 +39,7 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install Compose
uses: ndeloof/[email protected]
with:
Expand Down
16 changes: 8 additions & 8 deletions internal/ccsmp/ccsmp_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,18 @@ func ConvertCachedMessageSubscriptionRequestToCcsmpPropsList(cachedMessageSubscr

// CachedMessageSubscriptionRequestStrategyMappingToCCSMPCacheRequestFlags is the mapping for Cached message Subscription Request Strategies to respective CCSMP cache request flags
var CachedMessageSubscriptionRequestStrategyMappingToCCSMPCacheRequestFlags = map[resource.CachedMessageSubscriptionStrategy]C.solClient_cacheRequestFlags_t{
resource.AsAvailable: C.solClient_cacheRequestFlags_t(C.SOLCLIENT_CACHEREQUEST_FLAGS_LIVEDATA_FLOWTHRU | C.SOLCLIENT_CACHEREQUEST_FLAGS_NOWAIT_REPLY),
resource.LiveCancelsCached: C.solClient_cacheRequestFlags_t(C.SOLCLIENT_CACHEREQUEST_FLAGS_LIVEDATA_FULFILL | C.SOLCLIENT_CACHEREQUEST_FLAGS_NOWAIT_REPLY),
resource.CachedFirst: C.solClient_cacheRequestFlags_t(C.SOLCLIENT_CACHEREQUEST_FLAGS_LIVEDATA_QUEUE | C.SOLCLIENT_CACHEREQUEST_FLAGS_NOWAIT_REPLY),
resource.CachedOnly: C.solClient_cacheRequestFlags_t(C.SOLCLIENT_CACHEREQUEST_FLAGS_LIVEDATA_FLOWTHRU | C.SOLCLIENT_CACHEREQUEST_FLAGS_NOWAIT_REPLY),
resource.CacheRequestStrategyAsAvailable: C.solClient_cacheRequestFlags_t(C.SOLCLIENT_CACHEREQUEST_FLAGS_LIVEDATA_FLOWTHRU | C.SOLCLIENT_CACHEREQUEST_FLAGS_NOWAIT_REPLY),
resource.CacheRequestStrategyLiveCancelsCached: C.solClient_cacheRequestFlags_t(C.SOLCLIENT_CACHEREQUEST_FLAGS_LIVEDATA_FULFILL | C.SOLCLIENT_CACHEREQUEST_FLAGS_NOWAIT_REPLY),
resource.CacheRequestStrategyCachedFirst: C.solClient_cacheRequestFlags_t(C.SOLCLIENT_CACHEREQUEST_FLAGS_LIVEDATA_QUEUE | C.SOLCLIENT_CACHEREQUEST_FLAGS_NOWAIT_REPLY),
resource.CacheRequestStrategyCachedOnly: C.solClient_cacheRequestFlags_t(C.SOLCLIENT_CACHEREQUEST_FLAGS_LIVEDATA_FLOWTHRU | C.SOLCLIENT_CACHEREQUEST_FLAGS_NOWAIT_REPLY),
}

// CachedMessageSubscriptionRequestStrategyMappingToCCSMPSubscribeFlags is the mapping for Cached message Subscription Request Strategies to respective CCSMP subscription flags
var CachedMessageSubscriptionRequestStrategyMappingToCCSMPSubscribeFlags = map[resource.CachedMessageSubscriptionStrategy]C.solClient_subscribeFlags_t{
resource.AsAvailable: C.SOLCLIENT_SUBSCRIBE_FLAGS_REQUEST_CONFIRM,
resource.LiveCancelsCached: C.SOLCLIENT_SUBSCRIBE_FLAGS_REQUEST_CONFIRM,
resource.CachedFirst: C.SOLCLIENT_SUBSCRIBE_FLAGS_REQUEST_CONFIRM,
resource.CachedOnly: C.SOLCLIENT_SUBSCRIBE_FLAGS_LOCAL_DISPATCH_ONLY,
resource.CacheRequestStrategyAsAvailable: C.SOLCLIENT_SUBSCRIBE_FLAGS_REQUEST_CONFIRM,
resource.CacheRequestStrategyLiveCancelsCached: C.SOLCLIENT_SUBSCRIBE_FLAGS_REQUEST_CONFIRM,
resource.CacheRequestStrategyCachedFirst: C.SOLCLIENT_SUBSCRIBE_FLAGS_REQUEST_CONFIRM,
resource.CacheRequestStrategyCachedOnly: C.SOLCLIENT_SUBSCRIBE_FLAGS_LOCAL_DISPATCH_ONLY,
}

/* NOTE: sessionToCacheEventCallbackMap is required as a global var even though cache sessions etc. are scoped to a
Expand Down
22 changes: 11 additions & 11 deletions pkg/solace/resource/destination.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,21 +177,21 @@ func QueueNonDurableExclusiveAnonymous() *Queue {
type CachedMessageSubscriptionStrategy int

const (
// AsAvailable provides a configuration for receiving a concurrent mix of both live and cached messages on the given TopicSubscription.
AsAvailable CachedMessageSubscriptionStrategy = iota
// CacheRequestStrategyAsAvailable provides a configuration for receiving a concurrent mix of both live and cached messages on the given TopicSubscription.
CacheRequestStrategyAsAvailable CachedMessageSubscriptionStrategy = iota

// LiveCancelsCached provides a configuration for initially passing received cached messages to the application and as soon as live
// 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.
LiveCancelsCached
CacheRequestStrategyLiveCancelsCached

// CachedFirst provides a configuration for passing only cached messages to the application, before passing the received live messages.
// 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.
CachedFirst
CacheRequestStrategyCachedFirst

// CachedOnly provides a configuration for passing only cached messages and no live messages to the application.
CachedOnly
CacheRequestStrategyCachedOnly
)

// CachedMessageSubscriptionRequest provides an interface through which cache request configurations can be constructed. These
Expand Down Expand Up @@ -287,13 +287,13 @@ func NewCachedMessageSubscriptionRequest(cachedMessageSubscriptionStrategy Cache
// map the cachedMessageSubscriptionStrategy
var cachedMsgSubStrategy *CachedMessageSubscriptionStrategy = nil
switch cachedMessageSubscriptionStrategy {
case AsAvailable:
case CacheRequestStrategyAsAvailable:
fallthrough
case CachedFirst:
case CacheRequestStrategyCachedFirst:
fallthrough
case CachedOnly:
case CacheRequestStrategyCachedOnly:
fallthrough
case LiveCancelsCached:
case CacheRequestStrategyLiveCancelsCached:
// these are valid
cachedMsgSubStrategy = &cachedMessageSubscriptionStrategy
default:
Expand Down
8 changes: 4 additions & 4 deletions pkg/solace/resource/destination_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ func TestNewCachedMessageSubscriptionRequest(t *testing.T) {
const cacheAccessTimeout = 3001 // in valid range - (valid range from 3000 to signed MaxInt32)
const maxCachedMessages = 5 // in valid range (valid range from 0 to signed MaxInt32)
const cachedMessageAge = 15 // in valid range (valid range from 0 to signed MaxInt32)
cachedMessageSubscriptionRequest := resource.NewCachedMessageSubscriptionRequest(resource.LiveCancelsCached,
cachedMessageSubscriptionRequest := resource.NewCachedMessageSubscriptionRequest(resource.CacheRequestStrategyLiveCancelsCached,
cacheName, subscription, cacheAccessTimeout, maxCachedMessages, cachedMessageAge)

if *(cachedMessageSubscriptionRequest.GetCachedMessageSubscriptionRequestStrategy()) != resource.LiveCancelsCached {
if *(cachedMessageSubscriptionRequest.GetCachedMessageSubscriptionRequestStrategy()) != resource.CacheRequestStrategyLiveCancelsCached {
t.Error("Expected GetCachedMessageSubscriptionRequestStrategy() to match passed in cachedMessageSubscriptionStrategy when NewCachedMessageSubscriptionRequest() called with valid cachedMessageSubscriptionStrategy.")
}
if cachedMessageSubscriptionRequest.GetCacheName() != cacheName {
Expand Down Expand Up @@ -108,7 +108,7 @@ func TestNewCachedMessageSubscriptionRequestWithEmptyCacheName(t *testing.T) {
const cacheAccessTimeout = 5000 // (in milliseconds) - (valid range from 3000 to signed MaxInt32)
const maxCachedMessages = 5 // in valid range (valid range from 0 to signed MaxInt32)
const cachedMessageAge = 15 // in valid range (valid range from 0 to signed MaxInt32)
cachedMessageSubscriptionRequest := resource.NewCachedMessageSubscriptionRequest(resource.AsAvailable,
cachedMessageSubscriptionRequest := resource.NewCachedMessageSubscriptionRequest(resource.CacheRequestStrategyAsAvailable,
cacheName, subscription, cacheAccessTimeout, maxCachedMessages, cachedMessageAge)

if cachedMessageSubscriptionRequest.GetCacheName() != "" {
Expand All @@ -121,7 +121,7 @@ func TestNewCachedMessageSubscriptionRequestWithNilSubscription(t *testing.T) {
const cacheAccessTimeout = 5000 // (in milliseconds) - (valid range from 3000 to signed MaxInt32)
const maxCachedMessages = 5 // in valid range (valid range from 0 to signed MaxInt32)
const cachedMessageAge = 15 // in valid range (valid range from 0 to signed MaxInt32)
cachedMessageSubscriptionRequest := resource.NewCachedMessageSubscriptionRequest(resource.AsAvailable,
cachedMessageSubscriptionRequest := resource.NewCachedMessageSubscriptionRequest(resource.CacheRequestStrategyAsAvailable,
cacheName, nil, cacheAccessTimeout, maxCachedMessages, cachedMessageAge)

if cachedMessageSubscriptionRequest.GetName() != "" {
Expand Down
Loading

0 comments on commit a533d12

Please sign in to comment.