diff --git a/console-framework-client/src/main/java/io/axoniq/console/framework/client/SetupPayloadCreator.kt b/console-framework-client/src/main/java/io/axoniq/console/framework/client/SetupPayloadCreator.kt index 5ae1975..fa28301 100644 --- a/console-framework-client/src/main/java/io/axoniq/console/framework/client/SetupPayloadCreator.kt +++ b/console-framework-client/src/main/java/io/axoniq/console/framework/client/SetupPayloadCreator.kt @@ -1,12 +1,12 @@ /* - * Copyright (c) 2022-2023. AxonIQ B.V. + * Copyright (c) 2022-2024. AxonIQ B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -125,18 +125,19 @@ class SetupPayloadCreator( if (messageSource == null) { return UnspecifiedMessageSourceInformation("Unknown") } + val unwrapped = messageSource.unwrapPossiblyDecoratedClass(StreamableMessageSource::class.java) return when { - messageSource is MultiStreamableMessageSource -> MultiStreamableMessageSourceInformation( + unwrapped is MultiStreamableMessageSource -> MultiStreamableMessageSourceInformation( messageSource::class.java.name, messageSource.getPropertyValue>>("eventStreams")?.map { toMessageSource(processor, it) } ?: emptyList() ) - messageSource is EmbeddedEventStore -> createEmbeddedMessageSourceInformation(messageSource) - messageSource::class.java.simpleName == "AxonServerEventStore" -> createAxonServerMessageSourceInfoFromStore(messageSource) - messageSource::class.java.simpleName == "AxonServerMessageSource" -> createAxonServerMessageSourceInfoFromMessageSource(messageSource) - messageSource::class.java.simpleName == "AxonIQEventStorageEngine" -> createAxonServerMessageSourceInfoFromStorageEngine(messageSource) - else -> UnspecifiedMessageSourceInformation(messageSource::class.java.name) + unwrapped is EmbeddedEventStore -> createEmbeddedMessageSourceInformation(unwrapped) + unwrapped::class.java.simpleName == "AxonServerEventStore" -> createAxonServerMessageSourceInfoFromStore(unwrapped) + unwrapped::class.java.simpleName == "AxonServerMessageSource" -> createAxonServerMessageSourceInfoFromMessageSource(unwrapped) + unwrapped::class.java.simpleName == "AxonIQEventStorageEngine" -> createAxonServerMessageSourceInfoFromStorageEngine(unwrapped) + else -> UnspecifiedMessageSourceInformation(unwrapped::class.java.name) } } @@ -171,8 +172,8 @@ class SetupPayloadCreator( return EmbeddedEventStoreMessageSourceInformation( className = messageSource::class.java.name, optimizeEventConsumption = messageSource.getPropertyValue("optimizeEventConsumption"), - fetchDelay = messageSource.getPropertyValue("producer")?.getPropertyValue("fetchDelayNanos")?.let { it / 1_000_000 }, - cachedEvents = messageSource.getPropertyValue("producer")?.getPropertyValue("cachedEvents"), + fetchDelay = messageSource.getPropertyValue("producer")?.getPropertyValue("fetchDelayNanos")?.let { it / 1_000_000 }, + cachedEvents = messageSource.getPropertyValue("producer")?.getPropertyValue("cachedEvents"), cleanupDelay = messageSource.getPropertyValue("cleanupDelayMillis"), eventStorageEngineType = messageSource.getPropertyType("storageEngine") diff --git a/console-framework-client/src/main/java/io/axoniq/console/framework/utils.kt b/console-framework-client/src/main/java/io/axoniq/console/framework/utils.kt index 2edd5eb..86b08a0 100644 --- a/console-framework-client/src/main/java/io/axoniq/console/framework/utils.kt +++ b/console-framework-client/src/main/java/io/axoniq/console/framework/utils.kt @@ -6,7 +6,7 @@ * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -37,7 +37,7 @@ private fun T.fieldOfMatchingType(clazz: Class): Field? { // When we reach our own AS-classes, stop unwrapping if (this::class.java.name.startsWith("org.axonframework") && this::class.java.simpleName.startsWith("AxonServer")) return null return ReflectionUtils.fieldsOf(this::class.java) - .firstOrNull { f -> f.type.isAssignableFrom(clazz) } + .firstOrNull { f -> clazz.isAssignableFrom(f.type) } } fun MutableMap.computeIfAbsentWithRetry(key: K, retries: Int = 0, defaultValue: (K) -> V): V {