Skip to content

Commit 0182e16

Browse files
Merge pull request #126 from AxonIQ/feature/license-entitlement-feature
License Entitlement feature flag
2 parents e0c948f + 0726bc8 commit 0182e16

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

framework-client-api/src/main/java/io/axoniq/platform/framework/api/clientIdentification.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ data class SupportedFeatures(
110110
val domainEventsInsights: DomainEventAccessMode = DomainEventAccessMode.NONE,
111111
/* Whether the client supports client status updates .*/
112112
val clientStatusUpdates: Boolean? = false,
113+
/* Whether the application has the entitlement manager configured, allowing it to receive licenses */
114+
val licenseEntitlement: Boolean? = false,
113115
)
114116

115117
data class Versions(

framework-client-messaging/src/main/java/io/axoniq/platform/framework/client/SetupPayloadCreator.kt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ import org.axonframework.conversion.Converter
4444
import org.axonframework.messaging.commandhandling.CommandBus
4545
import org.axonframework.messaging.commandhandling.distributed.PayloadConvertingCommandBusConnector
4646
import org.axonframework.messaging.commandhandling.interception.InterceptingCommandBus
47-
import org.axonframework.messaging.core.MessageDispatchInterceptor
48-
import org.axonframework.messaging.core.MessageHandlerInterceptor
4947
import org.axonframework.messaging.core.SubscribableEventSource
5048
import org.axonframework.messaging.eventhandling.EventSink
5149
import org.axonframework.messaging.eventhandling.processing.EventProcessor
@@ -83,6 +81,7 @@ class SetupPayloadCreator(
8381
heartbeat = true,
8482
threadDump = true,
8583
clientStatusUpdates = true,
84+
licenseEntitlement = hasEntitlementManager()
8685
)
8786
)
8887
}
@@ -339,6 +338,18 @@ class SetupPayloadCreator(
339338
))?.javaClass?.simpleName?.let { SerializerInformation(type = it, false) }
340339
}
341340

341+
342+
/**
343+
* Checks whether the PlatformLicenseSource have been configured, in which case we want updates of licenses from Platform.
344+
*/
345+
private fun hasEntitlementManager(): Boolean {
346+
try {
347+
val entitlementManagerClazz = Class.forName("io.axoniq.license.entitlement.source.LicenseSource")
348+
return configuration.getComponents(entitlementManagerClazz).any { it.value::class.java.name == "io.axoniq.license.entitlement.source.PlatformLicenseSource" }
349+
} catch (_: ClassNotFoundException) {
350+
return false
351+
}
352+
}
342353
}
343354

344355

0 commit comments

Comments
 (0)