diff --git a/bom/datapool-dependencies/pom.xml b/bom/datapool-dependencies/pom.xml index 606e58b65..3373fc98a 100644 --- a/bom/datapool-dependencies/pom.xml +++ b/bom/datapool-dependencies/pom.xml @@ -6,7 +6,7 @@ io.holunda.polyflow polyflow-parent - 4.3.0 + 4.4.0 ../parent/pom.xml diff --git a/bom/parent/pom.xml b/bom/parent/pom.xml index e171aacfc..9d7964c69 100644 --- a/bom/parent/pom.xml +++ b/bom/parent/pom.xml @@ -6,7 +6,7 @@ io.holunda.polyflow polyflow-root - 4.3.0 + 4.4.0 ../../pom.xml @@ -21,11 +21,11 @@ 3.2.6 7.22.0 - 4.10.4 - 4.10.0 + 4.11.1 + 4.11.0 2.1.0 - 4.2.2 + 4.3.0 5.4.0 2.0.1 2.0.1.0 @@ -162,6 +162,11 @@ import pom + + io.toolisticon.spring + spring-boot-conditions + 1.0.0 + org.camunda.commons @@ -197,7 +202,7 @@ - io.github.microutils + io.github.oshai kotlin-logging-jvm ${kotlin-logging.version} @@ -273,7 +278,7 @@ kotlin-reflect - io.github.microutils + io.github.oshai kotlin-logging-jvm @@ -372,7 +377,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.13.0 + 3.14.0 UTF-8 ${java.version} @@ -620,7 +625,7 @@ maven-install-plugin - 3.1.3 + 3.1.4 diff --git a/bom/taskpool-dependencies/pom.xml b/bom/taskpool-dependencies/pom.xml index fa34ae801..6e1e054ea 100644 --- a/bom/taskpool-dependencies/pom.xml +++ b/bom/taskpool-dependencies/pom.xml @@ -6,7 +6,7 @@ io.holunda.polyflow polyflow-parent - 4.3.0 + 4.4.0 ../parent/pom.xml diff --git a/core/bus-jackson/pom.xml b/core/bus-jackson/pom.xml index 31c0da969..e887dc518 100755 --- a/core/bus-jackson/pom.xml +++ b/core/bus-jackson/pom.xml @@ -6,7 +6,7 @@ io.holunda.polyflow polyflow-parent - 4.3.0 + 4.4.0 ../../bom/parent/pom.xml @@ -60,9 +60,8 @@ provided - org.springframework.boot - spring-boot-autoconfigure - provided + io.toolisticon.spring + spring-boot-conditions diff --git a/core/bus-jackson/src/main/kotlin/io/holunda/polyflow/bus/jackson/annotation/AbstractQualifiedBeanCondition.kt b/core/bus-jackson/src/main/kotlin/io/holunda/polyflow/bus/jackson/annotation/AbstractQualifiedBeanCondition.kt deleted file mode 100644 index 0db874d73..000000000 --- a/core/bus-jackson/src/main/kotlin/io/holunda/polyflow/bus/jackson/annotation/AbstractQualifiedBeanCondition.kt +++ /dev/null @@ -1,143 +0,0 @@ -package io.holunda.polyflow.bus.jackson.annotation - -import org.slf4j.LoggerFactory -import org.springframework.beans.factory.NoSuchBeanDefinitionException -import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition -import org.springframework.beans.factory.annotation.Qualifier -import org.springframework.beans.factory.config.ConfigurableListableBeanFactory -import org.springframework.beans.factory.support.AbstractBeanDefinition -import org.springframework.beans.factory.support.RootBeanDefinition -import org.springframework.boot.autoconfigure.condition.ConditionOutcome -import org.springframework.boot.autoconfigure.condition.SpringBootCondition -import org.springframework.context.annotation.ConditionContext -import org.springframework.context.annotation.ConfigurationCondition -import org.springframework.context.annotation.ConfigurationCondition.ConfigurationPhase -import org.springframework.core.annotation.AnnotationUtils -import org.springframework.core.type.AnnotatedTypeMetadata -import org.springframework.util.ObjectUtils -import java.lang.invoke.MethodHandles -import java.util.stream.Stream - -/** - * Insired by org.axonframework.springboot.util.AbstractQualifiedBeanCondition - * Abstract implementations for conditions that match against the availability of beans of a specific type with a - * given qualifier. - - * Initialize the condition, looking for properties on a given annotation - * - * @param annotationName The fully qualified class name of the annotation to find attributes on. - * @param beanClassAttribute The attribute containing the bean class. - * @param qualifierAttribute The attribute containing the qualifier. - */ -abstract class AbstractQualifiedBeanCondition( - private val annotationName: String, - private val beanClassAttribute: String, - private val qualifierAttribute: String -) : SpringBootCondition(), ConfigurationCondition { - - companion object { - private val logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()) - } - - override fun getConfigurationPhase(): ConfigurationPhase { - return ConfigurationPhase.REGISTER_BEAN - } - - override fun getMatchOutcome(context: ConditionContext, metadata: AnnotatedTypeMetadata): ConditionOutcome { - val annotationAttributes = metadata.getAllAnnotationAttributes(annotationName, true) - val beanType = annotationAttributes!!.getFirst(beanClassAttribute) as String? - val qualifierAttr = annotationAttributes.getFirst(qualifierAttribute) as String? - val qualifier: String? - val qualifierMatch: Boolean - if (qualifierAttr!!.startsWith("!")) { - qualifier = qualifierAttr.substring(1) - qualifierMatch = false - } else { - qualifier = qualifierAttr - qualifierMatch = true - } - val qualifiers = qualifier.split(",".toRegex()).toTypedArray() - val conditionalClass: Class<*> = try { - Class.forName(beanType) - } catch (e: ClassNotFoundException) { - val failureMessage = String.format( - "Failed to extract a class instance for fully qualified class name [%s]", - beanType - ) - logger.warn(failureMessage, e) - return ConditionOutcome(false, failureMessage) - } - val bf = context.beanFactory - val anyMatch = Stream.of(*bf!!.getBeanNamesForType(conditionalClass)) - .anyMatch { beanName: String -> qualifierMatch == isOneMatching(beanName, bf, qualifiers) } - val message = if (anyMatch) String.format( - "Match found for class [%s] and qualifier [%s]", - conditionalClass, - qualifier - ) else String.format("No match found for class [%s] and qualifier [%s]", conditionalClass, qualifier) - return buildOutcome(anyMatch, message) - } - - private fun isOneMatching(beanName: String, bf: ConfigurableListableBeanFactory, qualifiers: Array): Boolean { - for (qualifier in qualifiers) { - if (isQualifierMatch(beanName, bf, qualifier)) { - return true - } - } - return false - } - - protected abstract fun buildOutcome(anyMatch: Boolean, message: String): ConditionOutcome - -} - -/** - * Inspired by org.axonframework.spring.SpringUtils.isQualifierMatch - */ -fun isQualifierMatch(beanName: String, beanFactory: ConfigurableListableBeanFactory, qualifier: String): Boolean { - return if (!beanFactory.containsBean(beanName)) { - false - } else { - try { - val bd = beanFactory.getMergedBeanDefinition(beanName) - if (bd is AnnotatedBeanDefinition) { - val factoryMethodMetadata = bd.factoryMethodMetadata - val qualifierAttributes = factoryMethodMetadata!!.getAnnotationAttributes(Qualifier::class.java.name) - if (qualifierAttributes != null && qualifier == qualifierAttributes["value"]) { - return true - } - } - if (bd is AbstractBeanDefinition) { - val candidate = bd.getQualifier(Qualifier::class.java.name) - if (candidate != null && qualifier == candidate.getAttribute("value") || qualifier == beanName || ObjectUtils.containsElement( - beanFactory.getAliases( - beanName - ), qualifier - ) - ) { - return true - } - } - var targetAnnotation: Qualifier? - if (bd is RootBeanDefinition) { - val factoryMethod = bd.resolvedFactoryMethod - if (factoryMethod != null) { - targetAnnotation = AnnotationUtils.getAnnotation(factoryMethod, Qualifier::class.java) - if (targetAnnotation != null) { - return qualifier == targetAnnotation.value - } - } - } - val beanType = beanFactory.getType(beanName) - if (beanType != null) { - targetAnnotation = AnnotationUtils.getAnnotation(beanType, Qualifier::class.java) - if (targetAnnotation != null) { - return qualifier == targetAnnotation.value - } - } - } catch (_: NoSuchBeanDefinitionException) { - } - false - } -} - diff --git a/core/bus-jackson/src/main/kotlin/io/holunda/polyflow/bus/jackson/annotation/ConditionalOnMissingQualifiedBean.kt b/core/bus-jackson/src/main/kotlin/io/holunda/polyflow/bus/jackson/annotation/ConditionalOnMissingQualifiedBean.kt deleted file mode 100644 index b3c5eefcb..000000000 --- a/core/bus-jackson/src/main/kotlin/io/holunda/polyflow/bus/jackson/annotation/ConditionalOnMissingQualifiedBean.kt +++ /dev/null @@ -1,47 +0,0 @@ -package io.holunda.polyflow.bus.jackson.annotation - -import org.springframework.context.annotation.Conditional -import kotlin.reflect.KClass - -/** - * Inspired by org.axonframework.springboot.util.ConditionalOnMissingQualifiedBean - * - * {@link Conditional} that only matches when for the specified bean class in the {@link BeanFactory} there is an - * instance which has the given {@code qualifier} set on it. - *

- * The condition can only match the bean definitions that have been processed by the - * application context so far and, as such, it is strongly recommended to use this - * condition on auto-configuration classes only. If a candidate bean may be created by - * another auto-configuration, make sure that the one using this condition runs after. - * - * @author Steven van Beelen - */ -@Target( - AnnotationTarget.ANNOTATION_CLASS, - AnnotationTarget.CLASS, - AnnotationTarget.FUNCTION, - AnnotationTarget.PROPERTY_GETTER, - AnnotationTarget.PROPERTY_SETTER -) -@Retention(AnnotationRetention.RUNTIME) -@MustBeDocumented -@Conditional( - OnMissingQualifiedBeanCondition::class -) -annotation class ConditionalOnMissingQualifiedBean( - /** - * The class type of bean that should be checked. The condition matches if the class specified is contained in the - * [ApplicationContext], together with the specified `qualifier`. - */ - val beanClass: KClass<*> = Any::class, - /** - * The qualifier which all instances of the given {code beanClass} in the [ApplicationContext] will be matched - * for. One may indicate that a qualifier should *not* be present by prefixing it with `!`, e.g: - * `qualifier = "!unqualified"`. - * - * - * Multiple qualifiers may be provided, separated with a comma (`,`). In that case, a bean matches when it is - * assigned one of the given qualifiers. - */ - val qualifier: String -) diff --git a/core/bus-jackson/src/main/kotlin/io/holunda/polyflow/bus/jackson/annotation/OnMissingQualifiedBeanCondition.kt b/core/bus-jackson/src/main/kotlin/io/holunda/polyflow/bus/jackson/annotation/OnMissingQualifiedBeanCondition.kt deleted file mode 100644 index 34307dee5..000000000 --- a/core/bus-jackson/src/main/kotlin/io/holunda/polyflow/bus/jackson/annotation/OnMissingQualifiedBeanCondition.kt +++ /dev/null @@ -1,18 +0,0 @@ -package io.holunda.polyflow.bus.jackson.annotation - -import org.springframework.boot.autoconfigure.condition.ConditionOutcome -import org.springframework.core.Ordered -import org.springframework.core.annotation.Order - -/** - * Insipred by - * [Condition] implementation to check for a bean instance of a specific class *and* a specific qualifier on it, - * matching if no such bean can be found. - */ -@Order(Ordered.LOWEST_PRECEDENCE) -class OnMissingQualifiedBeanCondition : AbstractQualifiedBeanCondition(ConditionalOnMissingQualifiedBean::class.java.name, "beanClass", "qualifier") { - override fun buildOutcome(anyMatch: Boolean, message: String): ConditionOutcome { - return ConditionOutcome(!anyMatch, message) - } - -} diff --git a/core/bus-jackson/src/main/kotlin/io/holunda/polyflow/bus/jackson/config/FallbackPayloadObjectMapperAutoConfiguration.kt b/core/bus-jackson/src/main/kotlin/io/holunda/polyflow/bus/jackson/config/FallbackPayloadObjectMapperAutoConfiguration.kt index a8af58eb7..64b3aab5b 100644 --- a/core/bus-jackson/src/main/kotlin/io/holunda/polyflow/bus/jackson/config/FallbackPayloadObjectMapperAutoConfiguration.kt +++ b/core/bus-jackson/src/main/kotlin/io/holunda/polyflow/bus/jackson/config/FallbackPayloadObjectMapperAutoConfiguration.kt @@ -2,18 +2,20 @@ package io.holunda.polyflow.bus.jackson.config import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper -import io.holunda.polyflow.bus.jackson.annotation.ConditionalOnMissingQualifiedBean +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.polyflow.bus.jackson.configurePolyflowJacksonObjectMapper -import mu.KLogging +import io.toolisticon.spring.condition.ConditionalOnMissingQualifiedBean import org.springframework.beans.factory.annotation.Qualifier import org.springframework.context.annotation.Bean +private val logger = KotlinLogging.logger {} + /** * No @configuration required, used as autoconfiguration. */ class FallbackPayloadObjectMapperAutoConfiguration { - companion object : KLogging() { + companion object { const val PAYLOAD_OBJECT_MAPPER = "payloadObjectMapper" } diff --git a/core/datapool/datapool-api/pom.xml b/core/datapool/datapool-api/pom.xml index b8698ec53..2a7f9f528 100755 --- a/core/datapool/datapool-api/pom.xml +++ b/core/datapool/datapool-api/pom.xml @@ -6,7 +6,7 @@ io.holunda.polyflow polyflow-datapool-parent - 4.3.0 + 4.4.0 polyflow-datapool-api diff --git a/core/datapool/datapool-core/pom.xml b/core/datapool/datapool-core/pom.xml index 3cca872fb..6e743a498 100644 --- a/core/datapool/datapool-core/pom.xml +++ b/core/datapool/datapool-core/pom.xml @@ -6,7 +6,7 @@ io.holunda.polyflow polyflow-datapool-parent - 4.3.0 + 4.4.0 polyflow-datapool-core diff --git a/core/datapool/datapool-core/src/main/kotlin/io/holunda/polyflow/datapool/core/DataPoolCoreAxonConfiguration.kt b/core/datapool/datapool-core/src/main/kotlin/io/holunda/polyflow/datapool/core/DataPoolCoreAxonConfiguration.kt index a3f6fd958..2dacb83db 100755 --- a/core/datapool/datapool-core/src/main/kotlin/io/holunda/polyflow/datapool/core/DataPoolCoreAxonConfiguration.kt +++ b/core/datapool/datapool-core/src/main/kotlin/io/holunda/polyflow/datapool/core/DataPoolCoreAxonConfiguration.kt @@ -6,7 +6,6 @@ import io.holunda.polyflow.datapool.core.business.CreateOrUpdateCommandHandler import io.holunda.polyflow.datapool.core.business.DataEntryAggregate import io.holunda.polyflow.datapool.core.business.upcaster.DataEntryCreatedEventUpcaster import io.holunda.polyflow.datapool.core.repository.FirstEventOnlyEventSourcingRepository -import mu.KLogging import org.axonframework.common.caching.Cache import org.axonframework.common.caching.WeakReferenceCache import org.axonframework.eventsourcing.EventCountSnapshotTriggerDefinition @@ -22,7 +21,6 @@ import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.context.annotation.Import - /** * Configuration of polyflow data pool core axon setup. */ @@ -33,7 +31,7 @@ import org.springframework.context.annotation.Import DataEntryCreatedEventUpcaster::class ) class DataPoolCoreAxonConfiguration { - companion object : KLogging() { + companion object { const val DATA_ENTRY_REPOSITORY = "dataEntryEventSourcingRepository" const val DATA_ENTRY_SNAPSHOTTER = "dataEntrySnapshotter" const val DATA_ENTRY_CACHE = "dataEntryCache" diff --git a/core/datapool/datapool-core/src/main/kotlin/io/holunda/polyflow/datapool/core/DataPoolCoreConfiguration.kt b/core/datapool/datapool-core/src/main/kotlin/io/holunda/polyflow/datapool/core/DataPoolCoreConfiguration.kt index db11e6fe7..788caf211 100755 --- a/core/datapool/datapool-core/src/main/kotlin/io/holunda/polyflow/datapool/core/DataPoolCoreConfiguration.kt +++ b/core/datapool/datapool-core/src/main/kotlin/io/holunda/polyflow/datapool/core/DataPoolCoreConfiguration.kt @@ -1,12 +1,12 @@ package io.holunda.polyflow.datapool.core -import mu.KLogging +import io.github.oshai.kotlinlogging.KotlinLogging import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration -import org.springframework.context.annotation.Import +private val logger = KotlinLogging.logger {} /** * Configuration of polyflow data pool core. @@ -17,7 +17,6 @@ import org.springframework.context.annotation.Import ) class DataPoolCoreConfiguration { - companion object: KLogging() /** * Deletion strategy for lax handling of updates after deletion (default). */ diff --git a/core/datapool/datapool-core/src/main/kotlin/io/holunda/polyflow/datapool/core/business/CreateOrUpdateCommandHandler.kt b/core/datapool/datapool-core/src/main/kotlin/io/holunda/polyflow/datapool/core/business/CreateOrUpdateCommandHandler.kt index 90750240d..b7a688c29 100755 --- a/core/datapool/datapool-core/src/main/kotlin/io/holunda/polyflow/datapool/core/business/CreateOrUpdateCommandHandler.kt +++ b/core/datapool/datapool-core/src/main/kotlin/io/holunda/polyflow/datapool/core/business/CreateOrUpdateCommandHandler.kt @@ -1,10 +1,10 @@ package io.holunda.polyflow.datapool.core.business +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.camunda.taskpool.api.business.CreateDataEntryCommand import io.holunda.camunda.taskpool.api.business.CreateOrUpdateDataEntryCommand import io.holunda.camunda.taskpool.api.business.UpdateDataEntryCommand import io.holunda.polyflow.datapool.core.DeletionStrategy -import mu.KLogging import org.axonframework.commandhandling.CommandHandler import org.axonframework.eventsourcing.EventSourcingRepository import org.axonframework.messaging.MetaData @@ -13,6 +13,8 @@ import org.axonframework.modelling.command.AggregateNotFoundException import org.springframework.stereotype.Component import java.util.* +private val logger = KotlinLogging.logger {} + /** * Handler taking care of existence of data entry aggregate. */ @@ -22,8 +24,6 @@ class CreateOrUpdateCommandHandler( private val deletionStrategy: DeletionStrategy ) { - companion object : KLogging() - /** * Receives create-or-update and decides what to do. * @param command command to create or update the aggregate. diff --git a/core/datapool/datapool-core/src/main/kotlin/io/holunda/polyflow/datapool/core/business/DataEntryAggregate.kt b/core/datapool/datapool-core/src/main/kotlin/io/holunda/polyflow/datapool/core/business/DataEntryAggregate.kt index 99e198cf7..d5fcb2102 100755 --- a/core/datapool/datapool-core/src/main/kotlin/io/holunda/polyflow/datapool/core/business/DataEntryAggregate.kt +++ b/core/datapool/datapool-core/src/main/kotlin/io/holunda/polyflow/datapool/core/business/DataEntryAggregate.kt @@ -1,10 +1,9 @@ package io.holunda.polyflow.datapool.core.business +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.camunda.taskpool.api.business.* import io.holunda.polyflow.datapool.core.DataPoolCoreAxonConfiguration -import io.holunda.polyflow.datapool.core.DataPoolCoreConfiguration import io.holunda.polyflow.datapool.core.DeletionStrategy -import mu.KLogging import org.axonframework.commandhandling.CommandHandler import org.axonframework.eventsourcing.AggregateDeletedException import org.axonframework.eventsourcing.EventSourcingHandler @@ -13,6 +12,8 @@ import org.axonframework.modelling.command.AggregateLifecycle import org.axonframework.spring.stereotype.Aggregate import org.springframework.beans.factory.annotation.Autowired +private val logger = KotlinLogging.logger {} + /** * Aggregate representing a data entry. * Currently, it has no state. @@ -25,8 +26,6 @@ import org.springframework.beans.factory.annotation.Autowired ) class DataEntryAggregate() { - companion object : KLogging() - @AggregateIdentifier private lateinit var dataIdentity: String private var deleted: Boolean = false @@ -95,10 +94,10 @@ class DataEntryAggregate() { if (this.deleted) { this.deleted = false } - if (logger.isDebugEnabled) { + if (logger.isDebugEnabled()) { logger.debug { "Created $dataIdentity." } } - if (logger.isTraceEnabled) { + if (logger.isTraceEnabled()) { logger.trace { "Created $dataIdentity with: $event" } } } @@ -111,10 +110,10 @@ class DataEntryAggregate() { if (this.deleted) { this.deleted = false } - if (logger.isDebugEnabled) { + if (logger.isDebugEnabled()) { logger.debug { "Updated $dataIdentity." } } - if (logger.isTraceEnabled) { + if (logger.isTraceEnabled()) { logger.trace { "Updated $dataIdentity with: $event" } } } @@ -124,10 +123,10 @@ class DataEntryAggregate() { */ @EventSourcingHandler fun on(event: DataEntryDeletedEvent) { - if (logger.isDebugEnabled) { + if (logger.isDebugEnabled()) { logger.debug { "Deleted $dataIdentity." } } - if (logger.isTraceEnabled) { + if (logger.isTraceEnabled()) { logger.trace { "Deleted $dataIdentity with: $event" } } // Don't use AggregateLifecycle.markDeleted() because then the combination of entryType / entryId is then really deleted forever diff --git a/core/datapool/datapool-core/src/test/kotlin/io/holunda/polyflow/datapool/core/business/DataEntryAggregateFirstEventOnlyEventSourcingRepositoryITest.kt b/core/datapool/datapool-core/src/test/kotlin/io/holunda/polyflow/datapool/core/business/DataEntryAggregateFirstEventOnlyEventSourcingRepositoryITest.kt index aff1a4693..b1e3c077e 100644 --- a/core/datapool/datapool-core/src/test/kotlin/io/holunda/polyflow/datapool/core/business/DataEntryAggregateFirstEventOnlyEventSourcingRepositoryITest.kt +++ b/core/datapool/datapool-core/src/test/kotlin/io/holunda/polyflow/datapool/core/business/DataEntryAggregateFirstEventOnlyEventSourcingRepositoryITest.kt @@ -1,8 +1,8 @@ package io.holunda.polyflow.datapool.core.business +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.camunda.taskpool.api.business.* import io.holunda.polyflow.datapool.core.itest.TestApplication -import mu.KLogging import org.assertj.core.api.Assertions.assertThat import org.axonframework.commandhandling.gateway.CommandGateway import org.axonframework.eventhandling.EventBus @@ -16,14 +16,13 @@ import org.springframework.boot.test.context.SpringBootTest import org.springframework.test.context.ActiveProfiles import org.springframework.test.context.junit.jupiter.SpringExtension +private val logger = KotlinLogging.logger {} @SpringBootTest(classes = [TestApplication::class]) @ActiveProfiles("itest-first-event-only") @ExtendWith(SpringExtension::class) internal class DataEntryAggregateFirstEventOnlyEventSourcingRepositoryITest { - companion object: KLogging() - @Autowired private lateinit var commandGateway: CommandGateway @@ -93,4 +92,4 @@ internal class DataEntryAggregateFirstEventOnlyEventSourcingRepositoryITest { assertThat(receivedEvents).hasSize(4) } -} \ No newline at end of file +} diff --git a/core/datapool/datapool-event/pom.xml b/core/datapool/datapool-event/pom.xml index 6e011bfbd..fc8944a57 100755 --- a/core/datapool/datapool-event/pom.xml +++ b/core/datapool/datapool-event/pom.xml @@ -6,7 +6,7 @@ io.holunda.polyflow polyflow-datapool-parent - 4.3.0 + 4.4.0 polyflow-datapool-event diff --git a/core/datapool/pom.xml b/core/datapool/pom.xml index 27e44f286..03af21ee4 100755 --- a/core/datapool/pom.xml +++ b/core/datapool/pom.xml @@ -6,7 +6,7 @@ io.holunda.polyflow polyflow-parent - 4.3.0 + 4.4.0 ../../bom/parent/pom.xml diff --git a/core/spring-utils/pom.xml b/core/spring-utils/pom.xml index d0eac964e..a7de4ca48 100755 --- a/core/spring-utils/pom.xml +++ b/core/spring-utils/pom.xml @@ -6,7 +6,7 @@ io.holunda.polyflow polyflow-parent - 4.3.0 + 4.4.0 ../../bom/parent/pom.xml diff --git a/core/taskpool/pom.xml b/core/taskpool/pom.xml index 409b68247..a73acf8da 100755 --- a/core/taskpool/pom.xml +++ b/core/taskpool/pom.xml @@ -6,7 +6,7 @@ io.holunda.polyflow polyflow-parent - 4.3.0 + 4.4.0 ../../bom/parent/pom.xml diff --git a/core/taskpool/taskpool-api/pom.xml b/core/taskpool/taskpool-api/pom.xml index 25e862e1a..e87394fdc 100755 --- a/core/taskpool/taskpool-api/pom.xml +++ b/core/taskpool/taskpool-api/pom.xml @@ -6,7 +6,7 @@ io.holunda.polyflow polyflow-taskpool-parent - 4.3.0 + 4.4.0 polyflow-taskpool-api diff --git a/core/taskpool/taskpool-core/pom.xml b/core/taskpool/taskpool-core/pom.xml index d5b20ddd5..dacaf87b3 100755 --- a/core/taskpool/taskpool-core/pom.xml +++ b/core/taskpool/taskpool-core/pom.xml @@ -6,7 +6,7 @@ io.holunda.polyflow polyflow-taskpool-parent - 4.3.0 + 4.4.0 polyflow-taskpool-core diff --git a/core/taskpool/taskpool-core/src/main/kotlin/io/holunda/polyflow/taskpool/core/process/ProcessInstanceAggregate.kt b/core/taskpool/taskpool-core/src/main/kotlin/io/holunda/polyflow/taskpool/core/process/ProcessInstanceAggregate.kt index 6bbd94340..42a72e40e 100644 --- a/core/taskpool/taskpool-core/src/main/kotlin/io/holunda/polyflow/taskpool/core/process/ProcessInstanceAggregate.kt +++ b/core/taskpool/taskpool-core/src/main/kotlin/io/holunda/polyflow/taskpool/core/process/ProcessInstanceAggregate.kt @@ -1,25 +1,25 @@ package io.holunda.polyflow.taskpool.core.process +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.camunda.taskpool.api.process.instance.* import io.holunda.camunda.taskpool.api.process.variable.ChangeProcessVariablesForExecutionCommand import io.holunda.camunda.taskpool.api.process.variable.ProcessVariablesChangedEvent import io.holunda.camunda.taskpool.mapper.process.* import io.holunda.polyflow.taskpool.core.TaskPoolCoreConfiguration -import mu.KLogging import org.axonframework.commandhandling.CommandHandler import org.axonframework.eventsourcing.EventSourcingHandler import org.axonframework.modelling.command.AggregateIdentifier import org.axonframework.modelling.command.AggregateLifecycle import org.axonframework.spring.stereotype.Aggregate +private val logger = KotlinLogging.logger {} + /** * Aggregate representing the process instance. */ @Aggregate(repository = TaskPoolCoreConfiguration.PROCESS_INSTANCE_AGGREGATE_REPOSITORY) class ProcessInstanceAggregate() { - companion object : KLogging() - @AggregateIdentifier lateinit var processInstanceId: String diff --git a/core/taskpool/taskpool-core/src/main/kotlin/io/holunda/polyflow/taskpool/core/task/TaskAggregate.kt b/core/taskpool/taskpool-core/src/main/kotlin/io/holunda/polyflow/taskpool/core/task/TaskAggregate.kt index 087d1d4cf..42b945b6e 100755 --- a/core/taskpool/taskpool-core/src/main/kotlin/io/holunda/polyflow/taskpool/core/task/TaskAggregate.kt +++ b/core/taskpool/taskpool-core/src/main/kotlin/io/holunda/polyflow/taskpool/core/task/TaskAggregate.kt @@ -1,10 +1,10 @@ package io.holunda.polyflow.taskpool.core.task +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.camunda.taskpool.api.task.* import io.holunda.camunda.taskpool.mapper.task.* import io.holunda.camunda.taskpool.model.Task import io.holunda.polyflow.taskpool.core.TaskPoolCoreConfiguration -import mu.KLogging import org.axonframework.commandhandling.CommandHandler import org.axonframework.eventsourcing.EventSourcingHandler import org.axonframework.messaging.MetaData @@ -12,6 +12,8 @@ import org.axonframework.modelling.command.AggregateIdentifier import org.axonframework.modelling.command.AggregateLifecycle import org.axonframework.spring.stereotype.Aggregate +private val logger = KotlinLogging.logger {} + /** * Main representation of the tasks available in the system. */ @@ -21,8 +23,6 @@ import org.axonframework.spring.stereotype.Aggregate ) class TaskAggregate() { - companion object : KLogging() - @AggregateIdentifier private lateinit var id: String internal lateinit var task: Task diff --git a/core/taskpool/taskpool-event/pom.xml b/core/taskpool/taskpool-event/pom.xml index c4ebf3d5e..13abaafd2 100644 --- a/core/taskpool/taskpool-event/pom.xml +++ b/core/taskpool/taskpool-event/pom.xml @@ -6,7 +6,7 @@ io.holunda.polyflow polyflow-taskpool-parent - 4.3.0 + 4.4.0 polyflow-taskpool-event diff --git a/core/taskpool/taskpool-event/src/main/kotlin/io/holunda/camunda/taskpool/upcast/definition/ProcessDefinitionEventUpcasters.kt b/core/taskpool/taskpool-event/src/main/kotlin/io/holunda/camunda/taskpool/upcast/definition/ProcessDefinitionEventUpcasters.kt index e70d6aed8..360442189 100644 --- a/core/taskpool/taskpool-event/src/main/kotlin/io/holunda/camunda/taskpool/upcast/definition/ProcessDefinitionEventUpcasters.kt +++ b/core/taskpool/taskpool-event/src/main/kotlin/io/holunda/camunda/taskpool/upcast/definition/ProcessDefinitionEventUpcasters.kt @@ -1,22 +1,23 @@ package io.holunda.camunda.taskpool.upcast.definition +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.camunda.taskpool.upcast.AnnotatedEventUpcaster import io.holunda.camunda.taskpool.upcast.AnnotationBasedSingleEventUpcaster -import io.holunda.camunda.taskpool.upcast.RepresentationContentType import io.holunda.camunda.taskpool.upcast.RepresentationContentType.JSON -import mu.KLogging import org.axonframework.serialization.SimpleSerializedType import org.axonframework.serialization.upcasting.event.IntermediateEventRepresentation import org.dom4j.Document import java.util.function.Function +private val logger = KotlinLogging.logger {} + /** * Upcaster to put revision 1 into the event and remove unneeded attributes. */ @AnnotatedEventUpcaster("io.holunda.camunda.taskpool.api.task.ProcessDefinitionRegisteredEvent") class ProcessDefinitionEventXMLNullTo1Upcaster : AnnotationBasedSingleEventUpcaster() { - companion object : KLogging() { + companion object { const val RESULT_OBJECT_TYPE = "io.holunda.camunda.taskpool.api.process.definition.ProcessDefinitionRegisteredEvent" } @@ -47,7 +48,7 @@ class ProcessDefinitionEventXMLNullTo1Upcaster : AnnotationBasedSingleEventUpcas @AnnotatedEventUpcaster("io.holunda.camunda.taskpool.api.task.ProcessDefinitionRegisteredEvent", representationContentType = JSON) class ProcessDefinitionEventJSONNullTo1Upcaster : AnnotationBasedSingleEventUpcaster() { - companion object : KLogging() { + companion object { const val RESULT_OBJECT_TYPE = "io.holunda.camunda.taskpool.api.process.definition.ProcessDefinitionRegisteredEvent" } diff --git a/core/taskpool/taskpool-event/src/main/kotlin/io/holunda/camunda/taskpool/upcast/task/TaskAttributeUpdatedEngineEvent4To5Upcaster.kt b/core/taskpool/taskpool-event/src/main/kotlin/io/holunda/camunda/taskpool/upcast/task/TaskAttributeUpdatedEngineEvent4To5Upcaster.kt index 7c32ccdc1..aa2824b3c 100644 --- a/core/taskpool/taskpool-event/src/main/kotlin/io/holunda/camunda/taskpool/upcast/task/TaskAttributeUpdatedEngineEvent4To5Upcaster.kt +++ b/core/taskpool/taskpool-event/src/main/kotlin/io/holunda/camunda/taskpool/upcast/task/TaskAttributeUpdatedEngineEvent4To5Upcaster.kt @@ -1,19 +1,21 @@ package io.holunda.camunda.taskpool.upcast.task +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.camunda.taskpool.upcast.AnnotatedEventUpcaster import io.holunda.camunda.taskpool.upcast.AnnotationBasedSingleEventUpcaster -import mu.KLogging import org.axonframework.serialization.SimpleSerializedType import org.axonframework.serialization.upcasting.event.IntermediateEventRepresentation import org.dom4j.Document +private val logger = KotlinLogging.logger {} + /** * Upcaster fixing payload and correlation changes introduced by #305, by adding the missing attributes to XML. */ @AnnotatedEventUpcaster(TaskAttributeUpdatedEngineEvent4To5Upcaster.RESULT_OBJECT_TYPE, "4") class TaskAttributeUpdatedEngineEvent4To5Upcaster : AnnotationBasedSingleEventUpcaster() { - companion object : KLogging() { + companion object { const val RESULT_OBJECT_TYPE = "io.holunda.camunda.taskpool.api.task.TaskAttributeUpdatedEngineEvent" } diff --git a/core/taskpool/taskpool-event/src/main/kotlin/io/holunda/camunda/taskpool/upcast/task/TaskEventEventUpcasterForPatchingSourceRefernce.kt b/core/taskpool/taskpool-event/src/main/kotlin/io/holunda/camunda/taskpool/upcast/task/TaskEventEventUpcasterForPatchingSourceRefernce.kt index 786c09617..2bddff04c 100644 --- a/core/taskpool/taskpool-event/src/main/kotlin/io/holunda/camunda/taskpool/upcast/task/TaskEventEventUpcasterForPatchingSourceRefernce.kt +++ b/core/taskpool/taskpool-event/src/main/kotlin/io/holunda/camunda/taskpool/upcast/task/TaskEventEventUpcasterForPatchingSourceRefernce.kt @@ -1,8 +1,8 @@ package io.holunda.camunda.taskpool.upcast.task +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.camunda.taskpool.upcast.AnnotatedEventUpcaster import io.holunda.camunda.taskpool.upcast.AnnotationBasedSingleEventUpcaster -import mu.KLogging import org.axonframework.serialization.SimpleSerializedType import org.axonframework.serialization.upcasting.event.IntermediateEventRepresentation import org.dom4j.Document @@ -152,13 +152,15 @@ class TaskUndeferredEvent2To4Upcaster : AbstractSourceReferenceElementRemovingUp override fun getType(): String = RESULT_OBJECT_TYPE } +private val logger = KotlinLogging.logger {} + /** * Abstract upcaster to be used for all task events. Removes the element duplicates from the source-reference tag introduced by the * usage of a sealed class instead of the interface. */ abstract class AbstractSourceReferenceElementRemovingUpcaster : AnnotationBasedSingleEventUpcaster() { - companion object : KLogging() { + companion object { val TAG_NAMES = arrayOf("instanceId", "executionId", "definitionId", "definitionKey", "name", "applicationName") } diff --git a/docs/reference-guide/components/common-datapool-sender.md b/docs/reference-guide/components/common-datapool-sender.md index d7c25ef51..c5c4774b0 100644 --- a/docs/reference-guide/components/common-datapool-sender.md +++ b/docs/reference-guide/components/common-datapool-sender.md @@ -43,8 +43,17 @@ In order to control sending of commands to command gateway, the command sender a `polyflow.integration.sender.data-entry.enabled` (default is `true`) is available. If disabled, the command sender will log any command instead of sending it to the command gateway. -In addition, you can control by the property `polyflow.integration.sender.data-entry.type` if you want to use the default command sender or provide your own implementation. -The default provided command sender (type: `simple`) just sends the commands synchronously using Axon Command Bus. +### Command sender types + +Out of the box, Polyflow supplies two command senders to match your deployment scenario. The property +`polyflow.integration.sender.data-entry.type` is used to switch between different commands senders. + + +| Sender type | Property value | Description | +|----------------------|----------------|-------------------------------------------------------------------------------------------------------------| +| Simple | simple | Simple command sender, used to send every command directly to Command Bus. | +| Transactional Direct | tx | Transactional accumulating command sender, sending accumulated commands along with the running transaction. | +| Custom | custom | Setting to provide your own sender implementation | !!! note If you want to implement a custom command sending, please provide your own implementation of the interface `DataEntryCommandSender` diff --git a/docs/reference-guide/components/common-taskpool-sender.md b/docs/reference-guide/components/common-taskpool-sender.md index d14ed5625..08337fe2c 100644 --- a/docs/reference-guide/components/common-taskpool-sender.md +++ b/docs/reference-guide/components/common-taskpool-sender.md @@ -40,7 +40,7 @@ will log any command instead of aggregating sending it to the command gateway. ### Command sender types Out of the box, Polyflow supplies several command senders to match your deployment scenario. The property -`polyflow.integration.task.sender.type` is used to switch between different commands senders. +`polyflow.integration.sender.task.type` is used to switch between different commands senders. | Sender type | Property value | Description | @@ -57,7 +57,7 @@ by the `AxonCommandListGateway` for sending the result over to the Axon command !!! note If you want to implement a custom command sending, please provide your own implementation of the interface `EngineTaskCommandSender` - (register a Spring Component of the type) and set the property `polyflow.integration.task.sender.type` to `custom`. + (register a Spring Component of the type) and set the property `polyflow.integration.sender.task.type` to `custom`. ### Command aggregation @@ -68,7 +68,7 @@ be successfully committed before sending any commands to the Command Gateway. Ot the transaction would be rolled-back and the command would create an inconsistency between the taskpool and the engine. Depending on your deployment scenario, you may want to control the exact point in time, when the commands are sent to command gateway. -The property `polyflow.integration.task.sender.send-within-transaction` is designed to influence this. If set to `true`, the commands +The property `polyflow.integration.sender.task.send-within-transaction` is designed to influence this. If set to `true`, the commands are accumulated _before_ the process engine transaction is committed, otherwise commands are sent _after_ the process engine transaction is committed. !!! warning @@ -85,7 +85,7 @@ perform the transmission of the commands to the Command Bus. This sender is in p By default, the data entry sender will serialize payload of the `DataEntry` into a JSON-Map structure, in order to be received by projections (Data Pool View) and storage of it, independent of the classes which might be not on the classpath of the projection (generic structure instead of a typed Java object structure). -This serialization can be disabled by the sender property `polyflow.integration.task.sender.serialize-payload=false`. +This serialization can be disabled by the sender property `polyflow.integration.sender.task.serialize-payload=false`. #### Handling command transmission diff --git a/integration/camunda-bpm/engine-client/pom.xml b/integration/camunda-bpm/engine-client/pom.xml index 1bebc5dfb..c0ec7bba0 100644 --- a/integration/camunda-bpm/engine-client/pom.xml +++ b/integration/camunda-bpm/engine-client/pom.xml @@ -5,7 +5,7 @@ io.holunda.polyflow polyflow-integration-camunda-bpm-engine-parent - 4.3.0 + 4.4.0 polyflow-camunda-bpm-engine-client diff --git a/integration/camunda-bpm/engine-client/src/main/kotlin/io/holunda/polyflow/client/camunda/task/TaskEventHandlers.kt b/integration/camunda-bpm/engine-client/src/main/kotlin/io/holunda/polyflow/client/camunda/task/TaskEventHandlers.kt index 1786ad3f5..457f985cb 100644 --- a/integration/camunda-bpm/engine-client/src/main/kotlin/io/holunda/polyflow/client/camunda/task/TaskEventHandlers.kt +++ b/integration/camunda-bpm/engine-client/src/main/kotlin/io/holunda/polyflow/client/camunda/task/TaskEventHandlers.kt @@ -1,13 +1,15 @@ package io.holunda.polyflow.client.camunda.task +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.camunda.taskpool.api.task.* import io.holunda.polyflow.client.camunda.CamundaEngineClientProperties -import mu.KLogging import org.axonframework.eventhandling.EventHandler import org.camunda.bpm.engine.ProcessEngineException import org.camunda.bpm.engine.TaskService import org.springframework.stereotype.Component +private val logger = KotlinLogging.logger {} + /** * Handles task events controls Camunda Task Service. */ @@ -17,8 +19,6 @@ class TaskEventHandlers( private val properties: CamundaEngineClientProperties ) { - companion object : KLogging() - /** * Engine reaction to claim. */ @@ -35,7 +35,7 @@ class TaskEventHandlers( logger.error { "CLIENT-004: Task with id ${event.id} was not found in the engine. Ignoring the event $event." } } } catch (e: ProcessEngineException) { - logger.error("CLIENT-001: Error claiming task", e) + logger.error(e) { "CLIENT-001: Error claiming task" } } } } @@ -56,7 +56,7 @@ class TaskEventHandlers( logger.error { "CLIENT-005: Task with id ${event.id} was not found in the engine. Ignoring the event $event." } } } catch (e: ProcessEngineException) { - logger.error("CLIENT-002: Error un-claiming task", e) + logger.error(e) { "CLIENT-002: Error un-claiming task" } } } } @@ -77,7 +77,7 @@ class TaskEventHandlers( logger.error { "CLIENT-006: Task with id ${event.id} was not found in the engine. Ignoring the event $event." } } } catch (e: ProcessEngineException) { - logger.error("CLIENT-003: Error completing task", e) + logger.error(e) { "CLIENT-003: Error completing task" } } } } @@ -97,13 +97,13 @@ class TaskEventHandlers( task.followUpDate = event.followUpDate taskService.saveTask(task) } else { - logger.debug("CLIENT-008: Task deferred event ignored because task with id ${event.id} had equal follow-up date set already.") + logger.debug { "CLIENT-008: Task deferred event ignored because task with id ${event.id} had equal follow-up date set already." } } } else { logger.error { "CLIENT-006: Task with id ${event.id} was not found in the engine. Ignoring the event $event." } } } catch (e: ProcessEngineException) { - logger.error("CLIENT-003: Error deferring task", e) + logger.error(e) { "CLIENT-003: Error deferring task" } } } } @@ -123,13 +123,13 @@ class TaskEventHandlers( task.followUpDate = null taskService.saveTask(task) } else { - logger.debug("CLIENT-007: Task undeferred event ignored because task with id ${event.id} was not deferred.") + logger.debug { "CLIENT-007: Task undeferred event ignored because task with id ${event.id} was not deferred." } } } else { logger.error { "CLIENT-006: Task with id ${event.id} was not found in the engine. Ignoring the event $event." } } } catch (e: ProcessEngineException) { - logger.error("CLIENT-003: Error deferring task", e) + logger.error(e) { "CLIENT-003: Error deferring task" } } } } diff --git a/integration/camunda-bpm/pom.xml b/integration/camunda-bpm/pom.xml index f6fe32a59..cda6deb41 100644 --- a/integration/camunda-bpm/pom.xml +++ b/integration/camunda-bpm/pom.xml @@ -6,7 +6,7 @@ io.holunda.polyflow polyflow-parent - 4.3.0 + 4.4.0 ../../bom/parent/pom.xml diff --git a/integration/camunda-bpm/springboot-autoconfigure/pom.xml b/integration/camunda-bpm/springboot-autoconfigure/pom.xml index f7c870c28..f6609d98e 100755 --- a/integration/camunda-bpm/springboot-autoconfigure/pom.xml +++ b/integration/camunda-bpm/springboot-autoconfigure/pom.xml @@ -6,7 +6,7 @@ io.holunda.polyflow polyflow-integration-camunda-bpm-engine-parent - 4.3.0 + 4.4.0 polyflow-camunda-bpm-springboot-autoconfigure diff --git a/integration/camunda-bpm/springboot-starter/pom.xml b/integration/camunda-bpm/springboot-starter/pom.xml index 15399bd7c..57436616a 100755 --- a/integration/camunda-bpm/springboot-starter/pom.xml +++ b/integration/camunda-bpm/springboot-starter/pom.xml @@ -6,7 +6,7 @@ io.holunda.polyflow polyflow-integration-camunda-bpm-engine-parent - 4.3.0 + 4.4.0 polyflow-camunda-bpm-springboot-starter diff --git a/integration/camunda-bpm/taskpool-collector/pom.xml b/integration/camunda-bpm/taskpool-collector/pom.xml index f8f233b47..9dac1d8c2 100755 --- a/integration/camunda-bpm/taskpool-collector/pom.xml +++ b/integration/camunda-bpm/taskpool-collector/pom.xml @@ -6,7 +6,7 @@ io.holunda.polyflow polyflow-integration-camunda-bpm-engine-parent - 4.3.0 + 4.4.0 polyflow-camunda-bpm-taskpool-collector diff --git a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/CamundaTaskpoolCollectorConfiguration.kt b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/CamundaTaskpoolCollectorConfiguration.kt index d836c8951..49fdc4f96 100755 --- a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/CamundaTaskpoolCollectorConfiguration.kt +++ b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/CamundaTaskpoolCollectorConfiguration.kt @@ -1,16 +1,18 @@ package io.holunda.polyflow.taskpool.collector +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.polyflow.spring.ApplicationNameBeanPostProcessor import io.holunda.polyflow.taskpool.collector.process.definition.ProcessDefinitionCollectorConfiguration import io.holunda.polyflow.taskpool.collector.process.instance.ProcessInstanceCollectorConfiguration import io.holunda.polyflow.taskpool.collector.process.variable.ProcessVariableCollectorConfiguration import io.holunda.polyflow.taskpool.collector.task.TaskCollectorConfiguration import jakarta.annotation.PostConstruct -import mu.KLogging import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.context.annotation.ComponentScan import org.springframework.context.annotation.Import +private val logger = KotlinLogging.logger {} + /** * Configuration of collector. */ @@ -27,7 +29,6 @@ import org.springframework.context.annotation.Import class CamundaTaskpoolCollectorConfiguration( private val properties: CamundaTaskpoolCollectorProperties ) { - companion object : KLogging() /** * Prints sender config. @@ -35,32 +36,32 @@ class CamundaTaskpoolCollectorConfiguration( @PostConstruct fun printConfiguration() { if (properties.task.enabled) { - logger.info("COLLECTOR-001: Task commands will be collected.") + logger.info { "COLLECTOR-001: Task commands will be collected." } when (properties.task.enricher.type) { - TaskCollectorEnricherType.processVariables -> logger.info("ENRICHER-001: Task commands will be enriched with process variables.") - TaskCollectorEnricherType.no -> logger.info("ENRICHER-002: Task commands will not be enriched.") - else -> logger.info("ENRICHER-003: Task commands will be enriched by a custom enricher.") + TaskCollectorEnricherType.processVariables -> logger.info { "ENRICHER-001: Task commands will be enriched with process variables." } + TaskCollectorEnricherType.no -> logger.info { "ENRICHER-002: Task commands will not be enriched." } + else -> logger.info { "ENRICHER-003: Task commands will be enriched by a custom enricher." } } } else { - logger.info("COLLECTOR-002: Task commands won't be collected.") + logger.info { "COLLECTOR-002: Task commands won't be collected." } } if (properties.processDefinition.enabled) { - logger.info("COLLECTOR-010: Process definition commands will be collected.") + logger.info { "COLLECTOR-010: Process definition commands will be collected." } } else { - logger.info("COLLECTOR-011: Process definition commands won't be collected.") + logger.info { "COLLECTOR-011: Process definition commands won't be collected." } } if (properties.processInstance.enabled) { - logger.info("COLLECTOR-012: Process instance commands will be collected.") + logger.info { "COLLECTOR-012: Process instance commands will be collected." } } else { - logger.info("COLLECTOR-013: Process instance commands won't be collected.") + logger.info { "COLLECTOR-013: Process instance commands won't be collected." } } if (properties.processInstance.enabled) { - logger.info("COLLECTOR-014: Process variable commands will be collected.") + logger.info { "COLLECTOR-014: Process variable commands will be collected." } } else { - logger.info("COLLECTOR-015: Process variable commands won't be collected.") + logger.info { "COLLECTOR-015: Process variable commands won't be collected." } } } } diff --git a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/definition/ProcessDefinitionCollectorConfiguration.kt b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/definition/ProcessDefinitionCollectorConfiguration.kt index 7df87e2c6..f979af4d8 100644 --- a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/definition/ProcessDefinitionCollectorConfiguration.kt +++ b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/definition/ProcessDefinitionCollectorConfiguration.kt @@ -1,8 +1,8 @@ package io.holunda.polyflow.taskpool.collector.process.definition +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.polyflow.taskpool.collector.CamundaTaskpoolCollectorProperties import io.holunda.polyflow.taskpool.sender.process.definition.ProcessDefinitionCommandSender -import mu.KLogging import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl import org.camunda.bpm.spring.boot.starter.util.SpringBootProcessEnginePlugin import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty @@ -10,6 +10,8 @@ import org.springframework.context.ApplicationEventPublisher import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +private val logger = KotlinLogging.logger {} + /** * Configuration for collecting the process definitions and sending them to taskpool core as commands. */ @@ -19,8 +21,6 @@ class ProcessDefinitionCollectorConfiguration( private val camundaTaskpoolCollectorProperties: CamundaTaskpoolCollectorProperties ) { - companion object : KLogging() - /** * Registers a plugin that is got refreshed on parse of BPMN. */ @@ -28,13 +28,13 @@ class ProcessDefinitionCollectorConfiguration( fun processDefinitionEnginePlugin() = object : SpringBootProcessEnginePlugin() { override fun preInit(processEngineConfiguration: ProcessEngineConfigurationImpl) { if (camundaTaskpoolCollectorProperties.processDefinition.enabled) { - logger.info("EVENTING-010: Process definition registration plugin activated.") + logger.info { "EVENTING-010: Process definition registration plugin activated." } processEngineConfiguration.customPostBPMNParseListeners.add( RefreshProcessDefinitionRegistrationParseListener(processEngineConfiguration) ) } else { - logger.info("EVENTING-011: Process definition registration disabled by property.") + logger.info { "EVENTING-011: Process definition registration disabled by property." } } } } diff --git a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/definition/ProcessDefinitionProcessor.kt b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/definition/ProcessDefinitionProcessor.kt index d301115a5..24c04e4e4 100644 --- a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/definition/ProcessDefinitionProcessor.kt +++ b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/definition/ProcessDefinitionProcessor.kt @@ -1,17 +1,18 @@ package io.holunda.polyflow.taskpool.collector.process.definition +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.camunda.taskpool.api.process.definition.ProcessDefinitionCommand import io.holunda.polyflow.taskpool.sender.process.definition.ProcessDefinitionCommandSender -import mu.KLogging import org.springframework.context.event.EventListener +private val logger = KotlinLogging.logger {} + /** * Processes commands sent via Spring Eventing and delegates them to taskpool command sender. */ class ProcessDefinitionProcessor( private val processDefinitionCommandSender: ProcessDefinitionCommandSender ) { - companion object : KLogging() /** * Receives the process definition command and pass it over to the sender. @@ -19,7 +20,7 @@ class ProcessDefinitionProcessor( */ @EventListener fun process(command: ProcessDefinitionCommand) { - if (logger.isTraceEnabled) { + if (logger.isTraceEnabled()) { logger.trace { "COLLECTOR-005: Sending process definition command: $command" } } processDefinitionCommandSender.send(command) diff --git a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/definition/RefreshProcessDefinitionsEventingJobHandler.kt b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/definition/RefreshProcessDefinitionsEventingJobHandler.kt index fd8fbcc0b..50e1547aa 100644 --- a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/definition/RefreshProcessDefinitionsEventingJobHandler.kt +++ b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/definition/RefreshProcessDefinitionsEventingJobHandler.kt @@ -1,6 +1,6 @@ package io.holunda.polyflow.taskpool.collector.process.definition -import mu.KLogging +import io.github.oshai.kotlinlogging.KotlinLogging import org.camunda.bpm.engine.impl.interceptor.Command import org.camunda.bpm.engine.impl.interceptor.CommandContext import org.camunda.bpm.engine.impl.jobexecutor.JobHandler @@ -9,7 +9,8 @@ import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity import org.camunda.bpm.engine.impl.persistence.entity.JobEntity import org.camunda.bpm.engine.impl.persistence.entity.MessageEntity import org.springframework.context.ApplicationEventPublisher -import org.springframework.stereotype.Component + +private val logger = KotlinLogging.logger {} /** * Sends out commands containing information about deployed process definitions. @@ -22,11 +23,16 @@ class RefreshProcessDefinitionsJobHandler( private val applicationEventPublisher: ApplicationEventPublisher ) : JobHandler { - companion object : KLogging() { + companion object { const val TYPE = "RefreshProcessDefinitionsJobHandler" } - override fun execute(configuration: RefreshProcessDefinitionsJobConfiguration, execution: ExecutionEntity?, commandContext: CommandContext, tenantId: String?) { + override fun execute( + configuration: RefreshProcessDefinitionsJobConfiguration, + execution: ExecutionEntity?, + commandContext: CommandContext, + tenantId: String? + ) { // deliver new commands on deployment of processes only. val commands = processDefinitionService.getProcessDefinitions( @@ -50,8 +56,6 @@ class RefreshProcessDefinitionsJobHandler( */ data class RefreshProcessDefinitionsJobCommand(val processDefinitionKey: String) : Command { - companion object : KLogging() - override fun execute(commandContext: CommandContext): String { logger.info { "EVENTING-021: New process definition detected. Sending the command for ${this.processDefinitionKey}." } val message = MessageEntity() diff --git a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/instance/ProcessInstanceEventCollectorService.kt b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/instance/ProcessInstanceEventCollectorService.kt index d53db345b..335372ebe 100644 --- a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/instance/ProcessInstanceEventCollectorService.kt +++ b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/instance/ProcessInstanceEventCollectorService.kt @@ -1,15 +1,17 @@ package io.holunda.polyflow.taskpool.collector.process.instance +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.camunda.taskpool.api.process.instance.* import io.holunda.polyflow.taskpool.sourceReference import io.holunda.polyflow.taskpool.collector.CamundaTaskpoolCollectorProperties -import mu.KLogging import org.camunda.bpm.engine.RepositoryService import org.camunda.bpm.engine.history.HistoricProcessInstance import org.camunda.bpm.engine.impl.history.event.HistoricProcessInstanceEventEntity import org.springframework.context.event.EventListener import org.springframework.core.annotation.Order +private val logger = KotlinLogging.logger {} + /** * Collects Camunda events and Camunda historic events and emits Process Instance Commands * @see [org.camunda.bpm.engine.impl.history.event.HistoryEventTypes] @@ -19,7 +21,7 @@ class ProcessInstanceEventCollectorService( private val repositoryService: RepositoryService ) { - companion object : KLogging() { + companion object { // high order to be later than all other listeners and work on changed entity const val ORDER = Integer.MAX_VALUE - 100 } diff --git a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/instance/ProcessInstanceProcessor.kt b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/instance/ProcessInstanceProcessor.kt index 8731e7bed..606f283d6 100644 --- a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/instance/ProcessInstanceProcessor.kt +++ b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/instance/ProcessInstanceProcessor.kt @@ -1,17 +1,18 @@ package io.holunda.polyflow.taskpool.collector.process.instance +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.camunda.taskpool.api.process.instance.ProcessInstanceCommand import io.holunda.polyflow.taskpool.sender.process.instance.ProcessInstanceCommandSender -import mu.KLogging import org.springframework.context.event.EventListener +private val logger = KotlinLogging.logger {} + /** * Default process instance processor. */ class ProcessInstanceProcessor( private val processInstanceCommandSender: ProcessInstanceCommandSender ) { - companion object : KLogging() /** * Reacts on incoming process instance commands. @@ -19,7 +20,7 @@ class ProcessInstanceProcessor( */ @EventListener fun process(command: ProcessInstanceCommand) { - if (logger.isTraceEnabled) { + if (logger.isTraceEnabled()) { logger.trace { "COLLECTOR-006: Sending process instance command: $command" } } processInstanceCommandSender.send(command) diff --git a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/variable/ProcessVariableEventCollectorService.kt b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/variable/ProcessVariableEventCollectorService.kt index 058966e84..277ed4103 100644 --- a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/variable/ProcessVariableEventCollectorService.kt +++ b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/variable/ProcessVariableEventCollectorService.kt @@ -1,12 +1,12 @@ package io.holunda.polyflow.taskpool.collector.process.variable +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.camunda.taskpool.api.process.variable.TypedValueProcessVariableValue +import io.holunda.polyflow.taskpool.collector.CamundaTaskpoolCollectorProperties import io.holunda.polyflow.taskpool.sender.process.variable.CreateSingleProcessVariableCommand import io.holunda.polyflow.taskpool.sender.process.variable.DeleteSingleProcessVariableCommand import io.holunda.polyflow.taskpool.sender.process.variable.UpdateSingleProcessVariableCommand import io.holunda.polyflow.taskpool.sourceReference -import io.holunda.polyflow.taskpool.collector.CamundaTaskpoolCollectorProperties -import mu.KLogging import org.camunda.bpm.engine.RepositoryService import org.camunda.bpm.engine.impl.history.event.HistoricVariableUpdateEventEntity import org.camunda.bpm.engine.impl.history.event.HistoryEventTypes @@ -14,7 +14,9 @@ import org.camunda.bpm.engine.impl.persistence.entity.HistoricDetailVariableInst import org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity import org.springframework.context.event.EventListener import org.springframework.core.annotation.Order -import org.springframework.stereotype.Component + + +private val logger = KotlinLogging.logger {} /** * Collects process variable events from camunda and create corresponding process variable commands. @@ -31,7 +33,7 @@ class ProcessVariableEventCollectorService( private val repositoryService: RepositoryService ) { - companion object : KLogging() { + companion object { // high order to be later than all other listeners and work on changed entity const val ORDER = Integer.MAX_VALUE - 100 } diff --git a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/variable/ProcessVariableProcessor.kt b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/variable/ProcessVariableProcessor.kt index 9f0b22950..b825ae1fb 100644 --- a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/variable/ProcessVariableProcessor.kt +++ b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/variable/ProcessVariableProcessor.kt @@ -1,11 +1,13 @@ package io.holunda.polyflow.taskpool.collector.process.variable +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.polyflow.taskpool.collector.task.enricher.ProcessVariablesFilter import io.holunda.polyflow.taskpool.sender.process.variable.ProcessVariableCommandSender import io.holunda.polyflow.taskpool.sender.process.variable.SingleProcessVariableCommand -import mu.KLogging import org.springframework.context.event.EventListener +private val logger = KotlinLogging.logger {} + /** * Process variable processor responsible for receiving the commands sent via spring eventing and send them to taskpool command sender. */ @@ -13,7 +15,6 @@ class ProcessVariableProcessor( private val processVariableCommandSender: ProcessVariableCommandSender, private val processVariablesFilter: ProcessVariablesFilter ) { - companion object : KLogging() /** * Reacts on incoming process variable commands. @@ -29,7 +30,7 @@ class ProcessVariableProcessor( // TODO: implement a variable value transformer. See #310 if (isIncluded) { - if (logger.isTraceEnabled) { + if (logger.isTraceEnabled()) { logger.trace { "COLLECTOR-007: Sending process variable command: $command" } } processVariableCommandSender.send(command) diff --git a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/task/TaskCollectorConfiguration.kt b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/task/TaskCollectorConfiguration.kt index 9434e7272..29d923a7d 100644 --- a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/task/TaskCollectorConfiguration.kt +++ b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/task/TaskCollectorConfiguration.kt @@ -1,7 +1,7 @@ package io.holunda.polyflow.taskpool.collector.task +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.camunda.taskpool.api.task.EngineTaskCommandFilter -import io.holunda.polyflow.taskpool.collector.CamundaTaskpoolCollectorConfiguration import io.holunda.polyflow.taskpool.collector.CamundaTaskpoolCollectorProperties import io.holunda.polyflow.taskpool.collector.TaskAssignerType import io.holunda.polyflow.taskpool.collector.TaskCollectorEnricherType @@ -27,6 +27,8 @@ import org.springframework.context.ApplicationEventPublisher import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +private val logger = KotlinLogging.logger {} + /** * Constructs the task collector components. */ @@ -147,7 +149,7 @@ class TaskCollectorConfiguration( ): TaskServiceCollectorService { if (engineTaskCommandFilter == null) { - CamundaTaskpoolCollectorConfiguration.logger.warn { "Task importer is configured, but no task filter is provided. All tasks commands will be rejected." } + logger.warn { "Task importer is configured, but no task filter is provided. All tasks commands will be rejected." } } return TaskServiceCollectorService( @@ -157,6 +159,5 @@ class TaskCollectorConfiguration( applicationEventPublisher = applicationEventPublisher, engineTaskCommandFilter = engineTaskCommandFilter ?: object : EngineTaskCommandFilter {} ) - } } diff --git a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/task/TaskCommandProcessor.kt b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/task/TaskCommandProcessor.kt index 0aa86f415..9961343fb 100644 --- a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/task/TaskCommandProcessor.kt +++ b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/task/TaskCommandProcessor.kt @@ -1,11 +1,13 @@ package io.holunda.polyflow.taskpool.collector.task +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.camunda.taskpool.api.task.EngineTaskCommand import io.holunda.camunda.taskpool.api.task.TaskIdentityWithPayloadAndCorrelations import io.holunda.polyflow.taskpool.sender.task.EngineTaskCommandSender -import mu.KLogging import org.springframework.context.event.EventListener +private val logger = KotlinLogging.logger {} + /** * Task command processor service. * This component is a sink of all engine task commands collected by the [TaskEventCollectorService] @@ -17,7 +19,6 @@ class TaskCommandProcessor( private val enricher: VariablesEnricher, private val taskAssigner: TaskAssigner ) { - companion object : KLogging() /** * Receives engine task command and delivers it to the sender. @@ -31,7 +32,7 @@ class TaskCommandProcessor( }.let { taskAssigner.setAssignment(it) }.also { commandToSend -> - if (logger.isTraceEnabled) { + if (logger.isTraceEnabled()) { logger.trace {"COLLECTOR-008: Sending engine task command: $commandToSend." } } // enrich and send diff --git a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/task/TaskEventCollectorService.kt b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/task/TaskEventCollectorService.kt index 2978b57e2..dd9d3f5f5 100755 --- a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/task/TaskEventCollectorService.kt +++ b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/task/TaskEventCollectorService.kt @@ -1,9 +1,9 @@ package io.holunda.polyflow.taskpool.collector.task +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.camunda.taskpool.api.task.* import io.holunda.polyflow.taskpool.* import io.holunda.polyflow.taskpool.collector.CamundaTaskpoolCollectorProperties -import mu.KLogging import org.camunda.bpm.engine.RepositoryService import org.camunda.bpm.engine.delegate.DelegateTask import org.camunda.bpm.engine.impl.history.event.HistoricIdentityLinkLogEventEntity @@ -13,6 +13,8 @@ import org.camunda.bpm.engine.task.IdentityLinkType import org.springframework.context.event.EventListener import org.springframework.core.annotation.Order +private val logger = KotlinLogging.logger {} + /** * Collects Camunda events and Camunda historic events (event listener order is {@link TaskEventCollectorService#ORDER}) and emits Commands */ @@ -22,8 +24,9 @@ class TaskEventCollectorService( ) { - companion object : KLogging() { + companion object { const val NAME = "taskEventCollectorService" + // high order to be later than all other listeners and work on changed entity const val ORDER = Integer.MAX_VALUE - 100 } @@ -34,11 +37,11 @@ class TaskEventCollectorService( @Order(ORDER - 10) @EventListener fun all(task: DelegateTask) { - if (logger.isTraceEnabled) { - logger.trace("Received " + task.eventName + " event on task with id " + task.id) + if (logger.isTraceEnabled()) { + logger.trace { "${"Received " + task.eventName + " event on task with id " + task.id}" } if (task is TaskEntity) { - logger.trace("\tProperties: {}", task.propertyChanges.keys.joinToString(",")) - logger.trace("\tIdentity links: {}", task.getIdentityLinkChanges().joinToString(",")) + logger.trace { "${"\tProperties: {}"} ${task.propertyChanges.keys.joinToString(",")}" } + logger.trace { "${"\tIdentity links: {}"} ${task.getIdentityLinkChanges().joinToString(",")}" } } } } @@ -87,7 +90,7 @@ class TaskEventCollectorService( // this method is intentionally empty to demonstrate that the assign event is captured. // we hence rely on historic identity link events to capture assignment via API and via listeners more accurately. // see implementation below - if (logger.isTraceEnabled) { + if (logger.isTraceEnabled()) { logger.trace { "Task ${task.id} is assigned to ${task.assignee}." } } } @@ -129,17 +132,17 @@ class TaskEventCollectorService( @Order(ORDER) @EventListener(condition = "#changeEvent.eventType.equals('update') && @taskEventCollectorService.camundaTaskpoolCollectorProperties.task.collectHistoryEvent('update')") fun update(changeEvent: HistoricTaskInstanceEventEntity): UpdateAttributesHistoricTaskCommand = - UpdateAttributesHistoricTaskCommand( - id = changeEvent.taskId, - description = changeEvent.description, - dueDate = changeEvent.dueDate, - followUpDate = changeEvent.followUpDate, - name = changeEvent.name, - owner = changeEvent.owner, - priority = changeEvent.priority, - taskDefinitionKey = changeEvent.taskDefinitionKey, - sourceReference = changeEvent.sourceReference(repositoryService, camundaTaskpoolCollectorProperties.applicationName) - ) + UpdateAttributesHistoricTaskCommand( + id = changeEvent.taskId, + description = changeEvent.description, + dueDate = changeEvent.dueDate, + followUpDate = changeEvent.followUpDate, + name = changeEvent.name, + owner = changeEvent.owner, + priority = changeEvent.priority, + taskDefinitionKey = changeEvent.taskDefinitionKey, + sourceReference = changeEvent.sourceReference(repositoryService, camundaTaskpoolCollectorProperties.applicationName) + ) /** * Fires update assignment historic command. @@ -171,8 +174,9 @@ class TaskEventCollectorService( id = changeEvent.taskId, candidateGroups = setOf(changeEvent.groupId) ) + else -> { - logger.warn("Received unexpected identity link historic update event ${changeEvent.type} ${changeEvent.operationType} ${changeEvent.eventType} on ${changeEvent.taskId}") + logger.warn { "Received unexpected identity link historic update event ${changeEvent.type} ${changeEvent.operationType} ${changeEvent.eventType} on ${changeEvent.taskId}" } null } } @@ -190,13 +194,13 @@ class TaskEventCollectorService( ) else -> { - logger.warn("Received unexpected identity link historic update event ${changeEvent.type} ${changeEvent.operationType} ${changeEvent.eventType} on ${changeEvent.taskId}") + logger.warn { "Received unexpected identity link historic update event ${changeEvent.type} ${changeEvent.operationType} ${changeEvent.eventType} on ${changeEvent.taskId}" } null } } else -> { - logger.warn("Received unexpected identity link historic update event ${changeEvent.type} ${changeEvent.operationType} ${changeEvent.eventType} on ${changeEvent.taskId}") + logger.warn { "Received unexpected identity link historic update event ${changeEvent.type} ${changeEvent.operationType} ${changeEvent.eventType} on ${changeEvent.taskId}" } null } } diff --git a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/task/TaskVariableLoader.kt b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/task/TaskVariableLoader.kt index 78ec156b5..ace8a3a0b 100644 --- a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/task/TaskVariableLoader.kt +++ b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/task/TaskVariableLoader.kt @@ -1,8 +1,8 @@ package io.holunda.polyflow.taskpool.collector.task +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.camunda.taskpool.api.task.* import io.holunda.polyflow.taskpool.callInProcessEngineContext -import mu.KLogging import org.camunda.bpm.engine.RuntimeService import org.camunda.bpm.engine.TaskService import org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager @@ -12,6 +12,8 @@ import org.camunda.bpm.engine.impl.interceptor.CommandExecutor import org.camunda.bpm.engine.variable.VariableMap import org.camunda.bpm.engine.variable.Variables +private val logger = KotlinLogging.logger {} + /** * Facility to load variables in a command context. * @param commandExecutor Camunda API executor. @@ -23,7 +25,6 @@ class TaskVariableLoader( private val taskService: TaskService, private val commandExecutor: CommandExecutor, ) { - companion object : KLogging() /** * Retrieves typed variables from the context of a command. diff --git a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/task/assigner/ProcessVariableChangeAssigningService.kt b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/task/assigner/ProcessVariableChangeAssigningService.kt index fc34058e8..f54dd1801 100644 --- a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/task/assigner/ProcessVariableChangeAssigningService.kt +++ b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/task/assigner/ProcessVariableChangeAssigningService.kt @@ -1,9 +1,11 @@ package io.holunda.polyflow.taskpool.collector.task.assigner -import io.holunda.camunda.taskpool.api.task.* +import io.holunda.camunda.taskpool.api.task.AddCandidateUsersCommand +import io.holunda.camunda.taskpool.api.task.AssignTaskCommand +import io.holunda.camunda.taskpool.api.task.EngineTaskCommand +import io.holunda.camunda.taskpool.api.task.SourceReference import io.holunda.polyflow.taskpool.sender.process.variable.CreateSingleProcessVariableCommand import io.holunda.polyflow.taskpool.sender.process.variable.UpdateSingleProcessVariableCommand -import mu.KLogging import org.camunda.bpm.engine.TaskService import org.springframework.context.event.EventListener @@ -19,8 +21,6 @@ class ProcessVariableChangeAssigningService( private val mapping: ProcessVariableTaskAssignerMapping ) { - companion object : KLogging() - /** * React on new variables created. */ @@ -35,6 +35,7 @@ class ProcessVariableChangeAssigningService( assignee = command.value.value.asStringValue() ) } + mapping.candidateUsers -> { if (command.value.value != null) { AddCandidateUsersCommand( @@ -45,6 +46,7 @@ class ProcessVariableChangeAssigningService( null } } + mapping.candidateGroups -> { null } @@ -66,6 +68,7 @@ class ProcessVariableChangeAssigningService( assignee = command.value.value.asStringValue() ) } + mapping.candidateUsers -> { if (command.value.value != null) { AddCandidateUsersCommand( @@ -76,6 +79,7 @@ class ProcessVariableChangeAssigningService( null } } + mapping.candidateGroups -> { null } diff --git a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/task/enricher/ProcessVariablesTaskCommandEnricher.kt b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/task/enricher/ProcessVariablesTaskCommandEnricher.kt index a71388750..cea39eb98 100755 --- a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/task/enricher/ProcessVariablesTaskCommandEnricher.kt +++ b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/task/enricher/ProcessVariablesTaskCommandEnricher.kt @@ -1,19 +1,9 @@ package io.holunda.polyflow.taskpool.collector.task.enricher -import io.holunda.camunda.taskpool.api.task.* -import io.holunda.polyflow.taskpool.callInProcessEngineContext +import io.holunda.camunda.taskpool.api.task.TaskIdentityWithPayloadAndCorrelations import io.holunda.polyflow.taskpool.collector.task.TaskVariableLoader import io.holunda.polyflow.taskpool.collector.task.VariablesEnricher import io.holunda.polyflow.taskpool.putAllTyped -import mu.KLogging -import org.camunda.bpm.engine.RuntimeService -import org.camunda.bpm.engine.TaskService -import org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager -import org.camunda.bpm.engine.impl.interceptor.CommandContext -import org.camunda.bpm.engine.impl.interceptor.CommandContextListener -import org.camunda.bpm.engine.impl.interceptor.CommandExecutor -import org.camunda.bpm.engine.variable.VariableMap -import org.camunda.bpm.engine.variable.Variables.createVariables /** * Enriches commands with process variables. @@ -25,9 +15,6 @@ open class ProcessVariablesTaskCommandEnricher( private val taskVariableLoader: TaskVariableLoader ) : VariablesEnricher { - companion object : KLogging() - - override fun enrich(command: T): T { // load variables typed diff --git a/integration/camunda-bpm/taskpool-job-sender/pom.xml b/integration/camunda-bpm/taskpool-job-sender/pom.xml index 6584c630f..2fa852a0d 100755 --- a/integration/camunda-bpm/taskpool-job-sender/pom.xml +++ b/integration/camunda-bpm/taskpool-job-sender/pom.xml @@ -6,7 +6,7 @@ io.holunda.polyflow polyflow-integration-camunda-bpm-engine-parent - 4.3.0 + 4.4.0 polyflow-camunda-bpm-taskpool-job-sender diff --git a/integration/camunda-bpm/taskpool-job-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/CamundaJobSenderConfiguration.kt b/integration/camunda-bpm/taskpool-job-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/CamundaJobSenderConfiguration.kt index cae2ddfa2..bda0ee9f0 100644 --- a/integration/camunda-bpm/taskpool-job-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/CamundaJobSenderConfiguration.kt +++ b/integration/camunda-bpm/taskpool-job-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/CamundaJobSenderConfiguration.kt @@ -4,15 +4,14 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper -import io.holunda.polyflow.bus.jackson.annotation.ConditionalOnMissingQualifiedBean import io.holunda.polyflow.bus.jackson.configurePolyflowJacksonObjectMapper import io.holunda.polyflow.taskpool.sender.gateway.CommandListGateway import io.holunda.polyflow.taskpool.sender.task.EngineTaskCommandSender import io.holunda.polyflow.taskpool.sender.task.accumulator.EngineTaskCommandAccumulator +import io.toolisticon.spring.condition.ConditionalOnMissingQualifiedBean import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl import org.camunda.bpm.engine.spring.SpringProcessEnginePlugin import org.springframework.beans.factory.annotation.Qualifier -import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty import org.springframework.context.annotation.Bean diff --git a/integration/camunda-bpm/taskpool-job-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/EngineTaskCommandsSendingJobHandler.kt b/integration/camunda-bpm/taskpool-job-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/EngineTaskCommandsSendingJobHandler.kt index d51a72c34..2d047761a 100644 --- a/integration/camunda-bpm/taskpool-job-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/EngineTaskCommandsSendingJobHandler.kt +++ b/integration/camunda-bpm/taskpool-job-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/EngineTaskCommandsSendingJobHandler.kt @@ -3,7 +3,6 @@ package io.holunda.polyflow.taskpool.sender import com.fasterxml.jackson.databind.ObjectMapper import io.holunda.camunda.taskpool.api.task.EngineTaskCommand import io.holunda.polyflow.taskpool.sender.gateway.CommandListGateway -import mu.KLogging import org.camunda.bpm.engine.impl.interceptor.CommandContext import org.camunda.bpm.engine.impl.jobexecutor.JobHandler import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity @@ -18,7 +17,7 @@ class EngineTaskCommandsSendingJobHandler( private val commandListGateway: CommandListGateway ) : JobHandler { - companion object : KLogging() { + companion object { const val TYPE = "polyflow-engine-task-command-sending" } diff --git a/integration/camunda-bpm/taskpool-job-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/TxAwareAccumulatingCamundaJobEngineTaskCommandSender.kt b/integration/camunda-bpm/taskpool-job-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/TxAwareAccumulatingCamundaJobEngineTaskCommandSender.kt index 1045d185e..06bf14935 100644 --- a/integration/camunda-bpm/taskpool-job-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/TxAwareAccumulatingCamundaJobEngineTaskCommandSender.kt +++ b/integration/camunda-bpm/taskpool-job-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/TxAwareAccumulatingCamundaJobEngineTaskCommandSender.kt @@ -1,7 +1,8 @@ package io.holunda.polyflow.taskpool.sender import com.fasterxml.jackson.databind.ObjectMapper -import io.holunda.polyflow.taskpool.sender.task.TxAwareAccumulatingEngineTaskCommandSender +import io.github.oshai.kotlinlogging.KotlinLogging +import io.holunda.polyflow.taskpool.sender.task.AbstractTxAwareAccumulatingEngineTaskCommandSender import io.holunda.polyflow.taskpool.sender.task.accumulator.EngineTaskCommandAccumulator import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl import org.camunda.bpm.engine.impl.persistence.entity.MessageEntity @@ -9,6 +10,8 @@ import org.camunda.bpm.engine.impl.persistence.entity.ResourceEntity import java.time.Instant import java.util.* +private val logger = KotlinLogging.logger {} + /** * Command sender writing a Camunda Jobj which will send commands later. */ @@ -17,7 +20,7 @@ class TxAwareAccumulatingCamundaJobEngineTaskCommandSender( private val objectMapper: ObjectMapper, engineTaskCommandAccumulator: EngineTaskCommandAccumulator, senderProperties: SenderProperties -) : TxAwareAccumulatingEngineTaskCommandSender( +) : AbstractTxAwareAccumulatingEngineTaskCommandSender( engineTaskCommandAccumulator = engineTaskCommandAccumulator, senderProperties = senderProperties, ) { @@ -28,7 +31,7 @@ class TxAwareAccumulatingCamundaJobEngineTaskCommandSender( taskCommands.get().forEach { (taskId, taskCommands) -> // handle messages for every task val accumulatorName = engineTaskCommandAccumulator::class.simpleName - logger.debug("SENDER-005: Handling ${taskCommands.size} commands for task $taskId using command accumulator $accumulatorName") + logger.debug { "SENDER-005: Handling ${taskCommands.size} commands for task $taskId using command accumulator $accumulatorName" } val commands = engineTaskCommandAccumulator.invoke(taskCommands) diff --git a/integration/common/datapool-sender/pom.xml b/integration/common/datapool-sender/pom.xml index 214fdec2a..6190862d6 100755 --- a/integration/common/datapool-sender/pom.xml +++ b/integration/common/datapool-sender/pom.xml @@ -6,7 +6,7 @@ io.holunda.polyflow polyflow-integration-common-parent - 4.3.0 + 4.4.0 polyflow-datapool-sender @@ -34,6 +34,10 @@ org.springframework.boot spring-boot-starter + + org.springframework + spring-tx + com.fasterxml.jackson.core jackson-core diff --git a/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/DataEntrySenderConfiguration.kt b/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/DataEntrySenderConfiguration.kt index dccd81465..9e3580cb0 100755 --- a/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/DataEntrySenderConfiguration.kt +++ b/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/DataEntrySenderConfiguration.kt @@ -1,15 +1,18 @@ package io.holunda.polyflow.datapool import com.fasterxml.jackson.databind.ObjectMapper -import io.holunda.polyflow.bus.jackson.config.FallbackPayloadObjectMapperAutoConfiguration.Companion.PAYLOAD_OBJECT_MAPPER +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.polyflow.datapool.projector.DataEntryProjectionSupplier import io.holunda.polyflow.datapool.projector.DataEntryProjector -import io.holunda.polyflow.datapool.sender.* +import io.holunda.polyflow.datapool.sender.AbstractDataEntryCommandSender +import io.holunda.polyflow.datapool.sender.DirectTxAwareAccumulatingDataEntryCommandSender +import io.holunda.polyflow.datapool.sender.SimpleDataEntryCommandSender +import io.holunda.polyflow.datapool.sender.gateway.* import io.holunda.polyflow.spring.ApplicationNameBeanPostProcessor +import jakarta.annotation.PostConstruct import org.axonframework.commandhandling.gateway.CommandGateway -import org.slf4j.LoggerFactory -import org.springframework.beans.factory.annotation.Qualifier -import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Import @@ -17,12 +20,15 @@ import org.springframework.context.annotation.Import /** * Polyflow sender configuration. */ -@EnableConfigurationProperties(DataEntrySenderProperties::class) +@EnableConfigurationProperties(DataPoolSenderProperties::class) @Import(ApplicationNameBeanPostProcessor::class) class DataEntrySenderConfiguration( - val properties: DataEntrySenderProperties + private val senderProperties: DataPoolSenderProperties ) { + /** Logger instance for this class. */ + private val logger = KotlinLogging.logger {} + /** * Initializes the projector. */ @@ -33,40 +39,77 @@ class DataEntrySenderConfiguration( * Default handler. */ @Bean - fun loggingDataEntryCommandSuccessHandler(): DataEntryCommandSuccessHandler = - LoggingCommandSuccessHandler(LoggerFactory.getLogger(DataEntryCommandSender::class.java)) + fun loggingDataEntryCommandSuccessHandler(): CommandSuccessHandler = LoggingDataEntryCommandSuccessHandler(logger) /** * Default handler. */ @Bean - fun loggingDataEntryCommandErrorHandler(): DataEntryCommandErrorHandler = - LoggingCommandErrorHandler(LoggerFactory.getLogger(DataEntryCommandSender::class.java)) + fun loggingDataEntryCommandErrorHandler(): CommandErrorHandler = LoggingDataEntryCommandErrorHandler(logger) + + /** + * Creates a command list gateway, if none is provided. + */ + @Bean + @ConditionalOnMissingBean(CommandListGateway::class) + fun dataEntryCommandListGateway( + commandGateway: CommandGateway, + commandSuccessHandler: CommandSuccessHandler, + commandErrorHandler: CommandErrorHandler + ) = AxonCommandListGateway( + commandGateway, + senderProperties, + commandSuccessHandler, + commandErrorHandler + ) + + /** + * Provide data entry sender properties as injectable Spring bean. + */ + @Bean + fun dataEntrySenderProperties() = senderProperties.dataEntry + + /** + * Creates simple (direct) command sender for data entries. + */ + @ConditionalOnProperty(value = ["polyflow.integration.sender.data-entry.type"], havingValue = "simple", matchIfMissing = true) + @Bean + fun simpleDataEntryCommandSender( + commandListGateway: CommandListGateway, + dataEntryProjector: DataEntryProjector, + objectMapper: ObjectMapper + ): AbstractDataEntryCommandSender = SimpleDataEntryCommandSender( + commandListGateway, + senderProperties.dataEntry, + dataEntryProjector, + objectMapper + ) /** - * Default configuration of the data entry sender. + * Creates transactional (direct) command sender for data entries. */ @Bean - @ConditionalOnExpression("'\${polyflow.integration.sender.data-entry.type}' != 'custom'") - fun configureSender( - gateway: CommandGateway, + @ConditionalOnProperty(value = ["polyflow.integration.sender.data-entry.type"], havingValue = "tx", matchIfMissing = false) + fun txAwareDirectDataEntryCommandSender( + commandListGateway: CommandListGateway, dataEntryProjector: DataEntryProjector, - dataEntryCommandSuccessHandler: DataEntryCommandSuccessHandler, - dataEntryCommandErrorHandler: DataEntryCommandErrorHandler, - @Qualifier(PAYLOAD_OBJECT_MAPPER) - objectMapper: ObjectMapper, - ): DataEntryCommandSender { - return when (properties.type) { - DataEntrySenderType.simple -> SimpleDataEntryCommandSender( - gateway = gateway, - properties = properties, - dataEntryProjector = dataEntryProjector, - successHandler = dataEntryCommandSuccessHandler, - errorHandler = dataEntryCommandErrorHandler, - objectMapper = objectMapper - ) + objectMapper: ObjectMapper + ): AbstractDataEntryCommandSender = DirectTxAwareAccumulatingDataEntryCommandSender( + commandListGateway, + senderProperties.dataEntry, + dataEntryProjector, + objectMapper + ) - else -> throw IllegalStateException("Could not initialize sender, used unknown ${properties.type} type.") + /** + * Prints sender config. + */ + @PostConstruct + fun printSenderConfiguration() { + if (senderProperties.dataEntry.enabled) { + logger.info("SENDER-111: Datapool data entry commands will be distributed over command bus.") + } else { + logger.info("SENDER-112: Datapool data entry command distribution is disabled by property.") } } } diff --git a/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/DataEntrySenderProperties.kt b/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/DataEntrySenderProperties.kt index 0053e6ddb..b37ba6875 100755 --- a/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/DataEntrySenderProperties.kt +++ b/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/DataEntrySenderProperties.kt @@ -6,7 +6,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties /** * Configuration properties for data entry sender (data pool) */ -@ConfigurationProperties(prefix = "polyflow.integration.sender.data-entry") +@ConfigurationProperties(prefix = "polyflow.integration.sender.data-entry") // must be declared to let ApplicationNameBeanPostProcessor work correctly data class DataEntrySenderProperties( /** * Flag to activate or de-activate the entire sender. @@ -24,7 +24,13 @@ data class DataEntrySenderProperties( /** * Serialize payload to `Map`. Defaults to true. */ - val serializePayload: Boolean = true + val serializePayload: Boolean = true, + /** + * This flag controls if the data entries are sent within an open transaction (value true, before commit) + * or not (value false, default, after commit). This setting is required if you move the command bus + * and the command handling on the engine side. + */ + val sendWithinTransaction: Boolean = false ) diff --git a/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/DataEntrySenderType.kt b/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/DataEntrySenderType.kt index 3d634fc5c..d67dfbf88 100644 --- a/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/DataEntrySenderType.kt +++ b/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/DataEntrySenderType.kt @@ -9,6 +9,11 @@ enum class DataEntrySenderType { */ simple, + /** + * Sender using Tx synchronization sending commands directly. + */ + tx, + /** * Custom = user-defined. */ diff --git a/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/DataPoolSenderProperties.kt b/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/DataPoolSenderProperties.kt new file mode 100644 index 000000000..186084241 --- /dev/null +++ b/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/DataPoolSenderProperties.kt @@ -0,0 +1,22 @@ +package io.holunda.polyflow.datapool + +import org.springframework.boot.context.properties.ConfigurationProperties +import org.springframework.boot.context.properties.NestedConfigurationProperty + +/** + * Holder for the enabled flag and the reference to the relevant [DataPoolSenderProperties]. + * The name is special in order to avoid name clashing with taskpool sender properties. + */ +@ConfigurationProperties(prefix = "polyflow.integration.sender") +data class DataPoolSenderProperties( + /** + * Global value to control the command gateway. + */ + val enabled: Boolean = true, + + /** + * Data entry properties. + */ + @NestedConfigurationProperty + val dataEntry: DataEntrySenderProperties = DataEntrySenderProperties(), +) diff --git a/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/AbstractDataEntryCommandSender.kt b/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/AbstractDataEntryCommandSender.kt new file mode 100755 index 000000000..1514ff901 --- /dev/null +++ b/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/AbstractDataEntryCommandSender.kt @@ -0,0 +1,130 @@ +package io.holunda.polyflow.datapool.sender + +import com.fasterxml.jackson.databind.ObjectMapper +import io.holunda.camunda.taskpool.api.business.* +import io.holunda.camunda.variable.serializer.serialize +import io.holunda.polyflow.datapool.DataEntrySenderProperties +import io.holunda.polyflow.datapool.projector.DataEntryProjectionSupplier +import io.holunda.polyflow.datapool.projector.DataEntryProjector +import org.axonframework.commandhandling.CommandMessage +import org.axonframework.commandhandling.GenericCommandMessage +import org.axonframework.messaging.MetaData +import org.camunda.bpm.engine.variable.VariableMap +import org.slf4j.Logger +import org.slf4j.LoggerFactory + +// FIXME: reason about the API and refactor it... +/** + * Simple data entry command sender. + */ +abstract class AbstractDataEntryCommandSender( + val properties: DataEntrySenderProperties, + private val dataEntryProjector: DataEntryProjector, + private val objectMapper: ObjectMapper +) : DataEntryCommandSender { + + /** to be more java friendly **/ + override fun sendDataEntryChange( + entryType: EntryType, + entryId: EntryId, + payload: Any, + name: String, + description: String?, + type: String, + state: DataEntryState + ) = sendDataEntryChange( + entryType = entryType, + entryId = entryId, + payload = payload, + name = name, + description = description, + type = type, + state = state, + modification = Modification.now(), + correlations = newCorrelations(), + authorizationChanges = listOf(), + metaData = MetaData.emptyInstance() + ) + + override fun sendDataEntryChange( + entryType: EntryType, + entryId: EntryId, + payload: Any, + name: String, + description: String?, + type: String, + state: DataEntryState, + modification: Modification, + correlations: CorrelationMap, + authorizationChanges: List, + metaData: MetaData + ) { + + val dataEntryProjectionSupplier: DataEntryProjectionSupplier? = dataEntryProjector.getProjection(entryType) + + val command = CreateOrUpdateDataEntryCommand( + dataEntryProjectionSupplier?.get()?.apply(entryId, payload) ?: DataEntryChange( + entryType = entryType, + entryId = entryId, + payload = if (properties.serializePayload) { + serialize(payload = payload, mapper = objectMapper) + } else { + if (payload is VariableMap) { + payload + } else { + throw IllegalArgumentException("Property for payload serialization is set to false, expected payload must be VariableMap but it was ${payload.javaClass.canonicalName}") + } + }, + correlations = correlations, + name = name, + type = type, + description = description, + authorizationChanges = authorizationChanges, + applicationName = properties.applicationName, + state = state, + modification = modification + ) + ) + this.sendDataEntryChange(command = command, metaData = metaData) + } + + override fun sendDataEntryChange(command: CreateOrUpdateDataEntryCommand, metaData: MetaData) { + if (properties.enabled) { + val message = GenericCommandMessage + .asCommandMessage(command) + .withMetaData(metaData) + send(message) + } else { + DataEntryCommandSender.logger.debug { "Would have sent change command $command" } + } + } + + override fun sendDataEntryDelete(command: DeleteDataEntryCommand, metaData: MetaData) { + if (properties.enabled) { + val message = GenericCommandMessage + .asCommandMessage(command) + .withMetaData(metaData) + send(message) + } else { + DataEntryCommandSender.logger.debug{ "Would have sent delete command $command" } + } + } + + override fun sendDataEntryAnonymize(command: AnonymizeDataEntryCommand, metaData: MetaData) { + if (properties.enabled) { + val message = GenericCommandMessage + .asCommandMessage(command) + .withMetaData(metaData) + send(message) + } else { + DataEntryCommandSender.logger.debug { "Would have sent anonymize command $command" } + } + } + + /** + * Sends a command message. + * @param command command message to send. + */ + abstract fun send(command: CommandMessage) +} + diff --git a/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/AbstractTxAwareAccumulatingDataEntryCommandSender.kt b/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/AbstractTxAwareAccumulatingDataEntryCommandSender.kt new file mode 100644 index 000000000..6251100f7 --- /dev/null +++ b/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/AbstractTxAwareAccumulatingDataEntryCommandSender.kt @@ -0,0 +1,68 @@ +package io.holunda.polyflow.datapool.sender + +import com.fasterxml.jackson.databind.ObjectMapper +import io.holunda.polyflow.datapool.DataEntrySenderProperties +import io.holunda.polyflow.datapool.projector.DataEntryProjector +import org.axonframework.commandhandling.CommandMessage +import org.springframework.transaction.support.TransactionSynchronization +import org.springframework.transaction.support.TransactionSynchronizationManager + +/** + * Collects commands of one transaction, accumulates them to one command and sends it after TX commit. + */ +abstract class AbstractTxAwareAccumulatingDataEntryCommandSender( + properties: DataEntrySenderProperties, + dataEntryProjector: DataEntryProjector, + objectMapper: ObjectMapper +) : AbstractDataEntryCommandSender(properties, dataEntryProjector, objectMapper) { + + private val registered: ThreadLocal = ThreadLocal.withInitial { false } + + protected val dataEntryCommands: ThreadLocal>>> = + ThreadLocal.withInitial { mutableMapOf() } + + override fun send(command: CommandMessage) { + // add command to list + dataEntryCommands.get().getOrPut(command.identifier) { mutableListOf() }.add(command) + + // register synchronization only once + if (!registered.get()) { + // send the result + TransactionSynchronizationManager.registerSynchronization(object : TransactionSynchronization { + /** + * Execute send if flag is set to send inside the TX. + */ + override fun beforeCommit(readOnly: Boolean) { + if (properties.sendWithinTransaction) { + send() + } + } + + /** + * Execute send if flag is set to send outside the TX. + */ + override fun afterCommit() { + if (!properties.sendWithinTransaction) { + send() + } + } + + /** + * Clean-up the thread on completion. + */ + override fun afterCompletion(status: Int) { + dataEntryCommands.remove() + registered.remove() + } + }) + + // mark as registered + registered.set(true) + } + } + + /** + * Triggers the command sending. + */ + abstract fun send() +} diff --git a/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/DataEntryCommandSender.kt b/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/DataEntryCommandSender.kt index e73d9903d..0251ac6b0 100755 --- a/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/DataEntryCommandSender.kt +++ b/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/DataEntryCommandSender.kt @@ -1,5 +1,6 @@ package io.holunda.polyflow.datapool.sender +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.camunda.taskpool.api.business.* import org.axonframework.commandhandling.CommandResultMessage import org.axonframework.messaging.MetaData @@ -10,6 +11,11 @@ import java.util.function.BiFunction */ interface DataEntryCommandSender { + /** Logger instance for all implementations of this interface. */ + companion object { + val logger = KotlinLogging.logger {} + } + /** * Sends command about data entry creation or update. * @param entryType type of entry. @@ -33,7 +39,11 @@ interface DataEntryCommandSender { state: DataEntryState = ProcessingType.UNDEFINED.of(), modification: Modification = Modification.now(), correlations: CorrelationMap = newCorrelations(), - authorizationChanges: List = if (modification.username != null) listOf(AuthorizationChange.addUser(modification.username!!)) else listOf(), + authorizationChanges: List = if (modification.username != null) { + listOf(AuthorizationChange.addUser(modification.username!!)) + } else { + listOf() + }, metaData: MetaData = MetaData.emptyInstance() ) diff --git a/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/DirectTxAwareAccumulatingDataEntryCommandSender.kt b/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/DirectTxAwareAccumulatingDataEntryCommandSender.kt new file mode 100644 index 000000000..1575964cc --- /dev/null +++ b/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/DirectTxAwareAccumulatingDataEntryCommandSender.kt @@ -0,0 +1,41 @@ +package io.holunda.polyflow.datapool.sender + +import com.fasterxml.jackson.databind.ObjectMapper +import io.holunda.polyflow.datapool.DataEntrySenderProperties +import io.holunda.polyflow.datapool.projector.DataEntryProjector +import io.holunda.polyflow.datapool.sender.gateway.CommandListGateway + +/** + * Accumulates commands and sends them directly in the same transaction. + */ +class DirectTxAwareAccumulatingDataEntryCommandSender( + private val commandListGateway: CommandListGateway, + properties: DataEntrySenderProperties, + dataEntryProjector: DataEntryProjector, + objectMapper: ObjectMapper +) : AbstractTxAwareAccumulatingDataEntryCommandSender( + properties, dataEntryProjector, objectMapper +) { + + override fun send() { + // iterate over messages and send them + dataEntryCommands.get().forEach { (identifier, commands) -> + DataEntryCommandSender.logger.debug("SENDER-105: Handling ${commands.size} commands for data entry $identifier") + // handle messages for every data entry + if (properties.enabled) { + commandListGateway.sendToGateway(commands) + DataEntryCommandSender.logger.trace { + "SENDER-TRACE: sending commands for data entry [${commands.first().identifier}]: " + commands.joinToString( + ", ", + "'", + "'", + -1, + "..." + ) { it.commandName } + } + } else { + DataEntryCommandSender.logger.debug { "SENDER-104: Data entry sending is disabled by property. Would have sent $commands." } + } + } + } +} diff --git a/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/LoggingCommandErrorHandler.kt b/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/LoggingCommandErrorHandler.kt deleted file mode 100644 index 293252985..000000000 --- a/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/LoggingCommandErrorHandler.kt +++ /dev/null @@ -1,14 +0,0 @@ -package io.holunda.polyflow.datapool.sender - -import org.axonframework.commandhandling.CommandResultMessage -import org.slf4j.Logger - -/** - * Error handler, logging the error. - */ -class LoggingCommandErrorHandler(private val logger: Logger) : DataEntryCommandErrorHandler { - - override fun apply(commandMessage: Any, commandResultMessage: CommandResultMessage) { - logger.error("SENDER-006: Sending command $commandMessage resulted in error", commandResultMessage.exceptionResult()) - } -} diff --git a/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/LoggingCommandSuccessHandler.kt b/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/LoggingCommandSuccessHandler.kt deleted file mode 100644 index 3cc35e6b1..000000000 --- a/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/LoggingCommandSuccessHandler.kt +++ /dev/null @@ -1,16 +0,0 @@ -package io.holunda.polyflow.datapool.sender - -import org.axonframework.commandhandling.CommandResultMessage -import org.slf4j.Logger - -/** - * Success handler, logging. - */ -class LoggingCommandSuccessHandler(private val logger: Logger) : DataEntryCommandSuccessHandler { - - override fun apply(commandMessage: Any, commandResultMessage: CommandResultMessage) { - if (logger.isDebugEnabled) { - logger.debug("Successfully submitted command $commandMessage, $commandResultMessage") - } - } -} diff --git a/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/SimpleDataEntryCommandSender.kt b/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/SimpleDataEntryCommandSender.kt old mode 100755 new mode 100644 index c7bd63688..82fe052b2 --- a/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/SimpleDataEntryCommandSender.kt +++ b/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/SimpleDataEntryCommandSender.kt @@ -1,147 +1,27 @@ package io.holunda.polyflow.datapool.sender import com.fasterxml.jackson.databind.ObjectMapper -import io.holunda.camunda.taskpool.api.business.* -import io.holunda.camunda.variable.serializer.serialize import io.holunda.polyflow.datapool.DataEntrySenderProperties -import io.holunda.polyflow.datapool.projector.DataEntryProjectionSupplier import io.holunda.polyflow.datapool.projector.DataEntryProjector -import org.axonframework.commandhandling.GenericCommandMessage -import org.axonframework.commandhandling.gateway.CommandGateway -import org.axonframework.messaging.MetaData -import org.camunda.bpm.engine.variable.VariableMap -import org.slf4j.Logger -import org.slf4j.LoggerFactory +import io.holunda.polyflow.datapool.sender.gateway.CommandListGateway +import org.axonframework.commandhandling.CommandMessage -// FIXME: reason about the API and refactor it... /** - * Simple data entry command sender. + * Sends commands using the gateway. */ class SimpleDataEntryCommandSender( - private val gateway: CommandGateway, - private val properties: DataEntrySenderProperties, - private val dataEntryProjector: DataEntryProjector, - private val successHandler: DataEntryCommandSuccessHandler, - private val errorHandler: DataEntryCommandErrorHandler, - private val objectMapper: ObjectMapper -) : DataEntryCommandSender { + private val commandListGateway: CommandListGateway, + properties: DataEntrySenderProperties, + dataEntryProjector: DataEntryProjector, + objectMapper: ObjectMapper +) : AbstractDataEntryCommandSender(properties, dataEntryProjector, objectMapper) { - private val logger: Logger = LoggerFactory.getLogger(DataEntryCommandSender::class.java) - - /** to be more java friendly **/ - override fun sendDataEntryChange( - entryType: EntryType, - entryId: EntryId, - payload: Any, - name: String, - description: String?, - type: String, - state: DataEntryState - ) = sendDataEntryChange( - entryType = entryType, - entryId = entryId, - payload = payload, - name = name, - description = description, - type = type, - state = state, - modification = Modification.now(), - correlations = newCorrelations(), - authorizationChanges = listOf(), - metaData = MetaData.emptyInstance() - ) - - override fun sendDataEntryChange( - entryType: EntryType, - entryId: EntryId, - payload: Any, - name: String, - description: String?, - type: String, - state: DataEntryState, - modification: Modification, - correlations: CorrelationMap, - authorizationChanges: List, - metaData: MetaData - ) { - - val dataEntryProjectionSupplier: DataEntryProjectionSupplier? = dataEntryProjector.getProjection(entryType) - - val command = CreateOrUpdateDataEntryCommand( - dataEntryProjectionSupplier?.get()?.apply(entryId, payload) ?: DataEntryChange( - entryType = entryType, - entryId = entryId, - payload = if (properties.serializePayload) { - serialize(payload = payload, mapper = objectMapper) - } else { - if (payload is VariableMap) { - payload - } else { - throw IllegalArgumentException("Property for payload serialization is set to false, expected payload must be VariableMap but it was ${payload.javaClass.canonicalName}") - } - }, - correlations = correlations, - name = name, - type = type, - description = description, - authorizationChanges = authorizationChanges, - applicationName = properties.applicationName, - state = state, - modification = modification - ) - ) - this.sendDataEntryChange(command = command, metaData = metaData) - } - - override fun sendDataEntryChange(command: CreateOrUpdateDataEntryCommand, metaData: MetaData) { - if (properties.enabled) { - val message = GenericCommandMessage - .asCommandMessage(command) - .withMetaData(metaData) - gateway.send(message) { m, r -> - if (r.isExceptional) { - errorHandler.apply(m, r) - } else { - successHandler.apply(m, r) - } - } - } else { - logger.debug("Would have sent change command $command") - } - } - - override fun sendDataEntryDelete(command: DeleteDataEntryCommand, metaData: MetaData) { + override fun send(command: CommandMessage) { if (properties.enabled) { - val message = GenericCommandMessage - .asCommandMessage(command) - .withMetaData(metaData) - gateway.send(message) { m, r -> - if (r.isExceptional) { - errorHandler.apply(m, r) - } else { - successHandler.apply(m, r) - } - } + commandListGateway.sendToGateway(listOf(command)) } else { - logger.debug("Would have sent delete command $command") + DataEntryCommandSender.logger.debug { "SENDER-104: Data entry sending is disabled by property. Would have sent $command." } } } - override fun sendDataEntryAnonymize(command: AnonymizeDataEntryCommand, metaData: MetaData) { - if (properties.enabled) { - val message = GenericCommandMessage - .asCommandMessage(command) - .withMetaData(metaData) - gateway.send(message) { m, r -> - if (r.isExceptional) { - errorHandler.apply(m, r) - } else { - successHandler.apply(m, r) - } - } - } else { - logger.debug("Would have sent anonymize command $command") - } - } } - diff --git a/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/gateway/AxonCommandListGateway.kt b/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/gateway/AxonCommandListGateway.kt new file mode 100644 index 000000000..d9ec50e23 --- /dev/null +++ b/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/gateway/AxonCommandListGateway.kt @@ -0,0 +1,48 @@ +package io.holunda.polyflow.datapool.sender.gateway + +import io.github.oshai.kotlinlogging.KotlinLogging +import io.holunda.polyflow.datapool.DataPoolSenderProperties +import org.axonframework.commandhandling.gateway.CommandGateway + +/** + * Sends a list commands via AXON command gateway one-by-one, only if the sender property is enabled. + */ +class AxonCommandListGateway( + private val commandGateway: CommandGateway, + private val senderProperties: DataPoolSenderProperties, + private val commandSuccessHandler: CommandSuccessHandler, + private val commandErrorHandler: CommandErrorHandler +) : CommandListGateway { + + /** Logger instance for this class. */ + private val logger = KotlinLogging.logger {} + + /** + * Sends data to gateway. Ignores any errors, but logs. + */ + override fun sendToGateway(commands: List) { + if (commands.isNotEmpty()) { + + val nextCommand = commands.first() + val remainingCommands = commands.subList(1, commands.size) + + if (senderProperties.enabled) { + commandGateway.send(nextCommand) { commandMessage, commandResultMessage -> + if (commandResultMessage.isExceptional) { + commandErrorHandler.apply(commandMessage, commandResultMessage) + } else { + commandSuccessHandler.apply(commandMessage, commandResultMessage) + } + sendToGateway(remainingCommands) + } + } else { + logger.debug { "SENDER-101: Sending command over gateway disabled by property. Would have sent command $nextCommand" } + sendToGateway(remainingCommands) + } + } + } + +} + + + diff --git a/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/gateway/CommandListGateway.kt b/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/gateway/CommandListGateway.kt new file mode 100644 index 000000000..cd7e64d5a --- /dev/null +++ b/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/gateway/CommandListGateway.kt @@ -0,0 +1,26 @@ +package io.holunda.polyflow.datapool.sender.gateway + +import org.axonframework.commandhandling.CommandResultMessage +import java.util.function.BiFunction + +/** + * Defines a gateway proxy, for sending commands. + */ +interface CommandListGateway { + + /** + * Sends a list of commands to gateway. + */ + fun sendToGateway(commands: List) + +} + +/** + * Handler for command errors. + */ +interface CommandErrorHandler : BiFunction, Unit> + +/** + * Handler for command results. + */ +interface CommandSuccessHandler : BiFunction, Unit> diff --git a/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/gateway/LoggingDataEntryCommandErrorHandler.kt b/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/gateway/LoggingDataEntryCommandErrorHandler.kt new file mode 100644 index 000000000..beb3ca2e0 --- /dev/null +++ b/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/gateway/LoggingDataEntryCommandErrorHandler.kt @@ -0,0 +1,15 @@ +package io.holunda.polyflow.datapool.sender.gateway + +import io.github.oshai.kotlinlogging.KLogger +import org.axonframework.commandhandling.CommandResultMessage +import org.slf4j.Logger + +/** + * Error handler, logging the error. + */ +open class LoggingDataEntryCommandErrorHandler(private val logger: KLogger) : CommandErrorHandler { + + override fun apply(commandMessage: Any, commandResultMessage: CommandResultMessage) { + logger.error(commandResultMessage.exceptionResult()) { "${"SENDER-103: Sending command $commandMessage resulted in error"}" } + } +} diff --git a/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/gateway/LoggingDataEntryCommandSuccessHandler.kt b/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/gateway/LoggingDataEntryCommandSuccessHandler.kt new file mode 100644 index 000000000..972c2ba54 --- /dev/null +++ b/integration/common/datapool-sender/src/main/kotlin/io/holunda/polyflow/datapool/sender/gateway/LoggingDataEntryCommandSuccessHandler.kt @@ -0,0 +1,17 @@ +package io.holunda.polyflow.datapool.sender.gateway + +import io.github.oshai.kotlinlogging.KLogger +import org.axonframework.commandhandling.CommandResultMessage +import org.slf4j.Logger + +/** + * Logs success. + */ +open class LoggingDataEntryCommandSuccessHandler(private val logger: KLogger) : CommandSuccessHandler { + + override fun apply(commandMessage: Any, commandResultMessage: CommandResultMessage) { + if (logger.isDebugEnabled()) { + logger.debug { "SENDER-102: Successfully submitted command $commandMessage" } + } + } +} diff --git a/integration/common/datapool-sender/src/test/kotlin/io/holunda/polyflow/datapool/DataEntrySenderPropertiesExtendedTest.kt b/integration/common/datapool-sender/src/test/kotlin/io/holunda/polyflow/datapool/DataEntryDataPoolSenderPropertiesExtendedTest.kt similarity index 83% rename from integration/common/datapool-sender/src/test/kotlin/io/holunda/polyflow/datapool/DataEntrySenderPropertiesExtendedTest.kt rename to integration/common/datapool-sender/src/test/kotlin/io/holunda/polyflow/datapool/DataEntryDataPoolSenderPropertiesExtendedTest.kt index 56575e724..fc6984f69 100644 --- a/integration/common/datapool-sender/src/test/kotlin/io/holunda/polyflow/datapool/DataEntrySenderPropertiesExtendedTest.kt +++ b/integration/common/datapool-sender/src/test/kotlin/io/holunda/polyflow/datapool/DataEntryDataPoolSenderPropertiesExtendedTest.kt @@ -11,13 +11,13 @@ import org.springframework.boot.context.annotation.UserConfigurations import org.springframework.boot.test.context.runner.ApplicationContextRunner import org.springframework.context.annotation.Bean -class DataEntrySenderPropertiesExtendedTest { +class DataEntryDataPoolSenderPropertiesExtendedTest { private val contextRunner = ApplicationContextRunner() .withConfiguration(UserConfigurations.of(DataEntrySenderConfiguration::class.java)) @Test - fun testMinimal() { + fun `test minimal`() { contextRunner .withUserConfiguration(TestMockConfiguration::class.java) .withPropertyValues( @@ -30,18 +30,20 @@ class DataEntrySenderPropertiesExtendedTest { assertThat(props.applicationName).isEqualTo("my-test-application") assertThat(props.enabled).isFalse assertThat(props.type).isEqualTo(DataEntrySenderType.simple) + assertThat(props.sendWithinTransaction).isFalse() } } @Test - fun testAllChanged() { + fun `test all changed`() { contextRunner .withUserConfiguration(TestMockConfiguration::class.java) .withPropertyValues( "spring.application.name=my-test-application", "polyflow.integration.sender.data-entry.application-name=another-than-spring", "polyflow.integration.sender.data-entry.enabled=true", - "polyflow.integration.sender.data-entry.type=custom", + "polyflow.integration.sender.data-entry.type=tx", + "polyflow.integration.sender.data-entry.send-within-transaction=true", ).run { assertThat(it.getBean(DataEntrySenderProperties::class.java)).isNotNull @@ -50,7 +52,8 @@ class DataEntrySenderPropertiesExtendedTest { assertThat(props.applicationName).isEqualTo("another-than-spring") assertThat(props.enabled).isTrue - assertThat(props.type).isEqualTo(DataEntrySenderType.custom) + assertThat(props.type).isEqualTo(DataEntrySenderType.tx) + assertThat(props.sendWithinTransaction).isTrue } } diff --git a/integration/common/datapool-sender/src/test/kotlin/io/holunda/polyflow/datapool/DataEntrySenderPropertiesITest.kt b/integration/common/datapool-sender/src/test/kotlin/io/holunda/polyflow/datapool/DataEntryDataPoolSenderPropertiesITest.kt similarity index 90% rename from integration/common/datapool-sender/src/test/kotlin/io/holunda/polyflow/datapool/DataEntrySenderPropertiesITest.kt rename to integration/common/datapool-sender/src/test/kotlin/io/holunda/polyflow/datapool/DataEntryDataPoolSenderPropertiesITest.kt index 91606186b..278bce741 100644 --- a/integration/common/datapool-sender/src/test/kotlin/io/holunda/polyflow/datapool/DataEntrySenderPropertiesITest.kt +++ b/integration/common/datapool-sender/src/test/kotlin/io/holunda/polyflow/datapool/DataEntryDataPoolSenderPropertiesITest.kt @@ -13,7 +13,7 @@ import org.springframework.test.context.junit.jupiter.SpringExtension @SpringBootTest(classes = [PropertiesTestApplication::class], webEnvironment = SpringBootTest.WebEnvironment.MOCK) @ActiveProfiles("properties-itest") @PropertySource -class DataEntrySenderPropertiesITest { +class DataEntryDataPoolSenderPropertiesITest { @Autowired lateinit var props: DataEntrySenderProperties @@ -23,6 +23,7 @@ class DataEntrySenderPropertiesITest { assertThat(props.applicationName).isEqualTo("Foo") assertThat(props.enabled).isFalse assertThat(props.type).isEqualTo(DataEntrySenderType.simple) + assertThat(props.sendWithinTransaction).isFalse() } } diff --git a/integration/common/pom.xml b/integration/common/pom.xml index 371cbf6b5..33b9ef9e4 100755 --- a/integration/common/pom.xml +++ b/integration/common/pom.xml @@ -6,7 +6,7 @@ io.holunda.polyflow polyflow-parent - 4.3.0 + 4.4.0 ../../bom/parent/pom.xml diff --git a/integration/common/tasklist-url-resolver/pom.xml b/integration/common/tasklist-url-resolver/pom.xml index 4a8fb7180..af57070e6 100644 --- a/integration/common/tasklist-url-resolver/pom.xml +++ b/integration/common/tasklist-url-resolver/pom.xml @@ -6,7 +6,7 @@ io.holunda.polyflow polyflow-integration-common-parent - 4.3.0 + 4.4.0 polyflow-tasklist-url-resolver diff --git a/integration/common/taskpool-sender/pom.xml b/integration/common/taskpool-sender/pom.xml index 19a0073ef..4332ac696 100755 --- a/integration/common/taskpool-sender/pom.xml +++ b/integration/common/taskpool-sender/pom.xml @@ -6,7 +6,7 @@ io.holunda.polyflow polyflow-integration-common-parent - 4.3.0 + 4.4.0 polyflow-taskpool-sender diff --git a/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/SenderConfiguration.kt b/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/SenderConfiguration.kt index a1a281b07..8fcd8dbde 100644 --- a/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/SenderConfiguration.kt +++ b/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/SenderConfiguration.kt @@ -1,6 +1,7 @@ package io.holunda.polyflow.taskpool.sender import com.fasterxml.jackson.databind.ObjectMapper +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.polyflow.bus.jackson.config.FallbackPayloadObjectMapperAutoConfiguration.Companion.PAYLOAD_OBJECT_MAPPER import io.holunda.polyflow.taskpool.sender.gateway.* import io.holunda.polyflow.taskpool.sender.process.definition.ProcessDefinitionCommandSender @@ -17,8 +18,6 @@ import io.holunda.polyflow.taskpool.sender.task.accumulator.EngineTaskCommandAcc import io.holunda.polyflow.taskpool.sender.task.accumulator.ProjectingCommandAccumulator import jakarta.annotation.PostConstruct import org.axonframework.commandhandling.gateway.CommandGateway -import org.slf4j.Logger -import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Qualifier import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty @@ -26,13 +25,16 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.context.ApplicationEventPublisher import org.springframework.context.annotation.Bean +private val logger = KotlinLogging.logger {} + /** * Main configuration of the taskpool sender component. */ @EnableConfigurationProperties(SenderProperties::class) class SenderConfiguration(private val senderProperties: SenderProperties) { - private val logger: Logger = LoggerFactory.getLogger(SenderConfiguration::class.java) + /** Logger instance for this class. */ + private val logger = KotlinLogging.logger {} /** * Creates generic task publisher. @@ -134,24 +136,24 @@ class SenderConfiguration(private val senderProperties: SenderProperties) { @PostConstruct fun printSenderConfiguration() { if (senderProperties.task.enabled) { - logger.info("SENDER-011: Taskpool task commands will be distributed over command bus.") + logger.info { "SENDER-011: Taskpool task commands will be distributed over command bus." } } else { - logger.info("SENDER-012: Taskpool task command distribution is disabled by property.") + logger.info { "SENDER-012: Taskpool task command distribution is disabled by property." } } if (senderProperties.processDefinition.enabled) { - logger.info("SENDER-013: Taskpool process definition commands will be distributed over command bus.") + logger.info { "SENDER-013: Taskpool process definition commands will be distributed over command bus." } } else { - logger.info("SENDER-014: Taskpool process definition command distribution is disabled by property.") + logger.info { "SENDER-014: Taskpool process definition command distribution is disabled by property." } } if (senderProperties.processInstance.enabled) { - logger.info("SENDER-015: Taskpool process instance commands will be distributed over command bus.") + logger.info { "SENDER-015: Taskpool process instance commands will be distributed over command bus." } } else { - logger.info("SENDER-016: Taskpool process instance command distribution is disabled by property.") + logger.info { "SENDER-016: Taskpool process instance command distribution is disabled by property." } } if (senderProperties.processVariable.enabled) { - logger.info("SENDER-017: Taskpool process variable commands will be distributed over command bus.") + logger.info { "SENDER-017: Taskpool process variable commands will be distributed over command bus." } } else { - logger.info("SENDER-018: Taskpool process variable command distribution is disabled by property.") + logger.info { "SENDER-018: Taskpool process variable command distribution is disabled by property." } } } diff --git a/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/SenderProperties.kt b/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/SenderProperties.kt index 30a116223..640b13c6c 100755 --- a/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/SenderProperties.kt +++ b/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/SenderProperties.kt @@ -116,7 +116,7 @@ enum class SenderType { simple, /** - * Sending using Tx synchronization sending commands directly. + * Sender using Tx synchronization sending commands directly. */ tx, diff --git a/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/gateway/AxonCommandListGateway.kt b/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/gateway/AxonCommandListGateway.kt index 4ed02c5ba..549aa42dd 100644 --- a/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/gateway/AxonCommandListGateway.kt +++ b/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/gateway/AxonCommandListGateway.kt @@ -1,10 +1,10 @@ package io.holunda.polyflow.taskpool.sender.gateway +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.polyflow.taskpool.sender.SenderProperties -import mu.KLogging import org.axonframework.commandhandling.gateway.CommandGateway -import org.slf4j.Logger -import org.slf4j.LoggerFactory + +private val logger = KotlinLogging.logger {} /** * Sends a list commands via AXON command gateway one-by-one, only if the sender property is enabled. @@ -16,8 +16,6 @@ class AxonCommandListGateway( private val commandErrorHandler: CommandErrorHandler ) : CommandListGateway { - companion object: KLogging() - /** * Sends data to gateway. Ignores any errors, but logs. */ @@ -37,7 +35,7 @@ class AxonCommandListGateway( sendToGateway(remainingCommands) } } else { - logger.debug("SENDER-001: Sending command over gateway disabled by property. Would have sent command $nextCommand") + logger.debug { "SENDER-001: Sending command over gateway disabled by property. Would have sent command $nextCommand" } sendToGateway(remainingCommands) } } diff --git a/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/gateway/LoggingTaskCommandErrorHandler.kt b/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/gateway/LoggingTaskCommandErrorHandler.kt index 71af33527..47cb5aac4 100644 --- a/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/gateway/LoggingTaskCommandErrorHandler.kt +++ b/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/gateway/LoggingTaskCommandErrorHandler.kt @@ -1,14 +1,14 @@ package io.holunda.polyflow.taskpool.sender.gateway +import io.github.oshai.kotlinlogging.KLogger import org.axonframework.commandhandling.CommandResultMessage -import org.slf4j.Logger /** * Error handler, logging the error. */ -open class LoggingTaskCommandErrorHandler(private val logger: Logger) : CommandErrorHandler { +open class LoggingTaskCommandErrorHandler(private val logger: KLogger) : CommandErrorHandler { override fun apply(commandMessage: Any, commandResultMessage: CommandResultMessage) { - logger.error("SENDER-003: Sending command $commandMessage resulted in error", commandResultMessage.exceptionResult()) + logger.error(commandResultMessage.exceptionResult()) { "SENDER-003: Sending command $commandMessage resulted in error" } } } diff --git a/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/gateway/LoggingTaskCommandSuccessHandler.kt b/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/gateway/LoggingTaskCommandSuccessHandler.kt index ab7f83e3f..70d4b6624 100644 --- a/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/gateway/LoggingTaskCommandSuccessHandler.kt +++ b/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/gateway/LoggingTaskCommandSuccessHandler.kt @@ -1,16 +1,16 @@ package io.holunda.polyflow.taskpool.sender.gateway +import io.github.oshai.kotlinlogging.KLogger import org.axonframework.commandhandling.CommandResultMessage -import org.slf4j.Logger /** * Logs success. */ -open class LoggingTaskCommandSuccessHandler(private val logger: Logger) : CommandSuccessHandler { +open class LoggingTaskCommandSuccessHandler(private val logger: KLogger) : CommandSuccessHandler { override fun apply(commandMessage: Any, commandResultMessage: CommandResultMessage) { - if (logger.isDebugEnabled) { - logger.debug("SENDER-002: Successfully submitted command $commandMessage") + if (logger.isDebugEnabled()) { + logger.debug { "SENDER-002: Successfully submitted command $commandMessage" } } } } diff --git a/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/process/definition/SimpleProcessDefinitionCommandSender.kt b/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/process/definition/SimpleProcessDefinitionCommandSender.kt index 8d4eefbbd..e34565f8b 100644 --- a/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/process/definition/SimpleProcessDefinitionCommandSender.kt +++ b/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/process/definition/SimpleProcessDefinitionCommandSender.kt @@ -1,9 +1,11 @@ package io.holunda.polyflow.taskpool.sender.process.definition +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.camunda.taskpool.api.process.definition.ProcessDefinitionCommand import io.holunda.polyflow.taskpool.sender.SenderProperties import io.holunda.polyflow.taskpool.sender.gateway.CommandListGateway -import mu.KLogging + +private val logger = KotlinLogging.logger {} /** * Simple sender for process definition commands @@ -13,8 +15,6 @@ internal class SimpleProcessDefinitionCommandSender( private val senderProperties: SenderProperties ) : ProcessDefinitionCommandSender { - companion object : KLogging() - override fun send(command: ProcessDefinitionCommand) { if (senderProperties.enabled && senderProperties.processDefinition.enabled) { commandListGateway.sendToGateway(listOf(command)) diff --git a/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/process/instance/SimpleProcessInstanceCommandSender.kt b/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/process/instance/SimpleProcessInstanceCommandSender.kt index c1524de67..949379fa9 100644 --- a/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/process/instance/SimpleProcessInstanceCommandSender.kt +++ b/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/process/instance/SimpleProcessInstanceCommandSender.kt @@ -1,9 +1,11 @@ package io.holunda.polyflow.taskpool.sender.process.instance +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.camunda.taskpool.api.process.instance.ProcessInstanceCommand import io.holunda.polyflow.taskpool.sender.SenderProperties import io.holunda.polyflow.taskpool.sender.gateway.CommandListGateway -import mu.KLogging + +private val logger = KotlinLogging.logger {} /** * Simple sender for process definition commands @@ -13,8 +15,6 @@ internal class SimpleProcessInstanceCommandSender( private val senderProperties: SenderProperties ) : ProcessInstanceCommandSender { - companion object : KLogging() - override fun send(command: ProcessInstanceCommand) { if (senderProperties.enabled && senderProperties.processInstance.enabled) { commandListGateway.sendToGateway(listOf(command)) diff --git a/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/process/variable/SimpleProcessVariableCommandSender.kt b/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/process/variable/SimpleProcessVariableCommandSender.kt index e57e15295..e5d01f575 100644 --- a/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/process/variable/SimpleProcessVariableCommandSender.kt +++ b/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/process/variable/SimpleProcessVariableCommandSender.kt @@ -1,6 +1,7 @@ package io.holunda.polyflow.taskpool.sender.process.variable import com.fasterxml.jackson.databind.ObjectMapper +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.camunda.taskpool.api.process.variable.ChangeProcessVariablesForExecutionCommand import io.holunda.camunda.taskpool.api.process.variable.ProcessVariableCreate import io.holunda.camunda.taskpool.api.process.variable.ProcessVariableDelete @@ -8,7 +9,8 @@ import io.holunda.camunda.taskpool.api.process.variable.ProcessVariableUpdate import io.holunda.polyflow.taskpool.sender.SenderProperties import io.holunda.polyflow.taskpool.sender.gateway.CommandListGateway import io.holunda.polyflow.taskpool.serialize -import mu.KLogging + +private val logger = KotlinLogging.logger {} /** * Simple sender for process variable commands. @@ -18,7 +20,6 @@ internal class SimpleProcessVariableCommandSender( private val senderProperties: SenderProperties, private val objectMapper: ObjectMapper ) : ProcessVariableCommandSender { - companion object : KLogging() override fun send(command: SingleProcessVariableCommand) { if (senderProperties.enabled && senderProperties.processVariable.enabled) { @@ -37,6 +38,7 @@ internal class SimpleProcessVariableCommandSender( ) ) ) + is UpdateSingleProcessVariableCommand -> ChangeProcessVariablesForExecutionCommand( sourceReference = command.sourceReference, variableChanges = listOf( @@ -49,6 +51,7 @@ internal class SimpleProcessVariableCommandSender( ) ) ) + is DeleteSingleProcessVariableCommand -> ChangeProcessVariablesForExecutionCommand( sourceReference = command.sourceReference, variableChanges = listOf( @@ -60,6 +63,7 @@ internal class SimpleProcessVariableCommandSender( ) ) ) + else -> throw IllegalArgumentException("Unknown variable command received $command") } ) diff --git a/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/process/variable/TxAwareAccumulatingProcessVariableCommandSender.kt b/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/process/variable/TxAwareAccumulatingProcessVariableCommandSender.kt index f517157cb..d9f7f1dc5 100644 --- a/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/process/variable/TxAwareAccumulatingProcessVariableCommandSender.kt +++ b/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/process/variable/TxAwareAccumulatingProcessVariableCommandSender.kt @@ -1,6 +1,7 @@ package io.holunda.polyflow.taskpool.sender.process.variable import com.fasterxml.jackson.databind.ObjectMapper +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.camunda.taskpool.api.process.variable.ChangeProcessVariablesForExecutionCommand import io.holunda.camunda.taskpool.api.process.variable.ProcessVariableCreate import io.holunda.camunda.taskpool.api.process.variable.ProcessVariableDelete @@ -8,10 +9,11 @@ import io.holunda.camunda.taskpool.api.process.variable.ProcessVariableUpdate import io.holunda.polyflow.taskpool.sender.SenderProperties import io.holunda.polyflow.taskpool.sender.gateway.CommandListGateway import io.holunda.polyflow.taskpool.serialize -import mu.KLogging import org.springframework.transaction.support.TransactionSynchronization import org.springframework.transaction.support.TransactionSynchronizationManager +private val logger = KotlinLogging.logger {} + /** * This sender collects all variable updates during one transaction and groups them by the * process instance id and sends over as a single command. @@ -22,8 +24,6 @@ class TxAwareAccumulatingProcessVariableCommandSender( private val objectMapper: ObjectMapper ) : ProcessVariableCommandSender { - companion object : KLogging() - private val registered: ThreadLocal = ThreadLocal.withInitial { false } @Suppress("RemoveExplicitTypeArguments") @@ -85,6 +85,7 @@ class TxAwareAccumulatingProcessVariableCommandSender( revision = command.revision, scopeActivityInstanceId = command.scopeActivityInstanceId ) + is UpdateSingleProcessVariableCommand -> ProcessVariableUpdate( value = command.value.serialize(objectMapper), variableInstanceId = command.variableInstanceId, @@ -92,12 +93,14 @@ class TxAwareAccumulatingProcessVariableCommandSender( revision = command.revision, scopeActivityInstanceId = command.scopeActivityInstanceId ) + is DeleteSingleProcessVariableCommand -> ProcessVariableDelete( variableInstanceId = command.variableInstanceId, variableName = command.variableName, revision = command.revision, scopeActivityInstanceId = command.scopeActivityInstanceId ) + else -> throw IllegalArgumentException("Unsupported variable sender command.") } } diff --git a/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/task/TxAwareAccumulatingEngineTaskCommandSender.kt b/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/task/AbstractTxAwareAccumulatingEngineTaskCommandSender.kt similarity index 92% rename from integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/task/TxAwareAccumulatingEngineTaskCommandSender.kt rename to integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/task/AbstractTxAwareAccumulatingEngineTaskCommandSender.kt index c86e51e57..0aa0e7f4c 100644 --- a/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/task/TxAwareAccumulatingEngineTaskCommandSender.kt +++ b/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/task/AbstractTxAwareAccumulatingEngineTaskCommandSender.kt @@ -2,22 +2,18 @@ package io.holunda.polyflow.taskpool.sender.task import io.holunda.camunda.taskpool.api.task.EngineTaskCommand import io.holunda.polyflow.taskpool.sender.SenderProperties -import io.holunda.polyflow.taskpool.sender.gateway.CommandListGateway import io.holunda.polyflow.taskpool.sender.task.accumulator.EngineTaskCommandAccumulator -import mu.KLogging import org.springframework.transaction.support.TransactionSynchronization import org.springframework.transaction.support.TransactionSynchronizationManager /** * Collects commands of one transaction, accumulates them to one command and sends it after TX commit. */ -abstract class TxAwareAccumulatingEngineTaskCommandSender( +abstract class AbstractTxAwareAccumulatingEngineTaskCommandSender( protected val engineTaskCommandAccumulator: EngineTaskCommandAccumulator, protected val senderProperties: SenderProperties ) : EngineTaskCommandSender { - companion object : KLogging() - private val registered: ThreadLocal = ThreadLocal.withInitial { false } @Suppress("RemoveExplicitTypeArguments") diff --git a/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/task/DirectTxAwareAccumulatingEngineTaskCommandSender.kt b/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/task/DirectTxAwareAccumulatingEngineTaskCommandSender.kt index 13292df01..45a6bbba9 100644 --- a/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/task/DirectTxAwareAccumulatingEngineTaskCommandSender.kt +++ b/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/task/DirectTxAwareAccumulatingEngineTaskCommandSender.kt @@ -1,9 +1,12 @@ package io.holunda.polyflow.taskpool.sender.task +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.polyflow.taskpool.sender.SenderProperties import io.holunda.polyflow.taskpool.sender.gateway.CommandListGateway import io.holunda.polyflow.taskpool.sender.task.accumulator.EngineTaskCommandAccumulator +private val logger = KotlinLogging.logger {} + /** * Accumulates commands and sends them directly in the same transaction. */ @@ -11,7 +14,7 @@ class DirectTxAwareAccumulatingEngineTaskCommandSender( private val commandListGateway: CommandListGateway, engineTaskCommandAccumulator: EngineTaskCommandAccumulator, senderProperties: SenderProperties -) : TxAwareAccumulatingEngineTaskCommandSender( +) : AbstractTxAwareAccumulatingEngineTaskCommandSender( engineTaskCommandAccumulator = engineTaskCommandAccumulator, senderProperties = senderProperties ) { @@ -20,7 +23,7 @@ class DirectTxAwareAccumulatingEngineTaskCommandSender( // iterate over messages and send them taskCommands.get().forEach { (taskId, taskCommands) -> val accumulatorName = engineTaskCommandAccumulator::class.simpleName - logger.debug("SENDER-005: Handling ${taskCommands.size} commands for task $taskId using command accumulator $accumulatorName") + logger.debug { "SENDER-005: Handling ${taskCommands.size} commands for task $taskId using command accumulator $accumulatorName" } val commands = engineTaskCommandAccumulator.invoke(taskCommands) // handle messages for every task if (senderProperties.enabled && senderProperties.task.enabled) { diff --git a/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/task/SimpleEngineTaskCommandSender.kt b/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/task/SimpleEngineTaskCommandSender.kt index 6b2ee3318..31f5dc0a1 100644 --- a/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/task/SimpleEngineTaskCommandSender.kt +++ b/integration/common/taskpool-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/task/SimpleEngineTaskCommandSender.kt @@ -1,9 +1,11 @@ package io.holunda.polyflow.taskpool.sender.task +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.camunda.taskpool.api.task.EngineTaskCommand import io.holunda.polyflow.taskpool.sender.SenderProperties import io.holunda.polyflow.taskpool.sender.gateway.CommandListGateway -import mu.KLogging + +private val logger = KotlinLogging.logger {} /** * Sends commands using the gateway. @@ -13,8 +15,6 @@ class SimpleEngineTaskCommandSender( private val senderProperties: SenderProperties ) : EngineTaskCommandSender { - companion object : KLogging() - override fun send(command: EngineTaskCommand) { if (senderProperties.task.enabled) { commandListGateway.sendToGateway(listOf(command)) diff --git a/integration/common/taskpool-sender/src/test/kotlin/io/holunda/polyflow/taskpool/sender/gateway/AxonCommandListGatewayTest.kt b/integration/common/taskpool-sender/src/test/kotlin/io/holunda/polyflow/taskpool/sender/gateway/AxonCommandListGatewayTest.kt index fe940c47a..f2c305d47 100644 --- a/integration/common/taskpool-sender/src/test/kotlin/io/holunda/polyflow/taskpool/sender/gateway/AxonCommandListGatewayTest.kt +++ b/integration/common/taskpool-sender/src/test/kotlin/io/holunda/polyflow/taskpool/sender/gateway/AxonCommandListGatewayTest.kt @@ -1,10 +1,10 @@ package io.holunda.polyflow.taskpool.sender.gateway +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.camunda.taskpool.api.task.AssignTaskCommand import io.holunda.camunda.taskpool.api.task.CreateTaskCommand import io.holunda.camunda.taskpool.api.task.ProcessReference import io.holunda.polyflow.taskpool.sender.SenderProperties -import mu.KLogging import org.axonframework.commandhandling.CommandCallback import org.axonframework.commandhandling.GenericCommandMessage import org.axonframework.commandhandling.GenericCommandResultMessage @@ -20,11 +20,11 @@ import org.mockito.Mockito.verify import org.mockito.Mockito.verifyNoMoreInteractions import org.mockito.junit.jupiter.MockitoExtension +private val logger = KotlinLogging.logger {} + @ExtendWith(MockitoExtension::class) class AxonCommandListGatewayTest { - companion object : KLogging() - @Mock lateinit var commandGateway: CommandGateway diff --git a/integration/common/variable-serializer/pom.xml b/integration/common/variable-serializer/pom.xml index 6e2b1a68e..44bfe2ba4 100755 --- a/integration/common/variable-serializer/pom.xml +++ b/integration/common/variable-serializer/pom.xml @@ -6,7 +6,7 @@ io.holunda.polyflow polyflow-integration-common-parent - 4.3.0 + 4.4.0 polyflow-variable-serializer diff --git a/pom.xml b/pom.xml index 27e7c2b6e..15b6a3f00 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ io.holunda.polyflow polyflow-root - 4.3.0 + 4.4.0 pom POM: ${project.artifactId} @@ -22,7 +22,7 @@ 2.1.10 ${java.version} true - 3.0.5 + 7.0.4 @@ -40,7 +40,7 @@ org.apache.maven.plugins maven-clean-plugin - 3.4.0 + 3.4.1 @@ -130,7 +130,7 @@ org.apache.maven.plugins maven-deploy-plugin - 3.1.3 + 3.1.4 true diff --git a/view/form-url-resolver/pom.xml b/view/form-url-resolver/pom.xml index e51b4ec58..6305ca766 100644 --- a/view/form-url-resolver/pom.xml +++ b/view/form-url-resolver/pom.xml @@ -6,7 +6,7 @@ io.holunda.polyflow polyflow-view-parent - 4.3.0 + 4.4.0 polyflow-form-url-resolver diff --git a/view/jpa/pom.xml b/view/jpa/pom.xml index 9e6e2bdd3..011c205e4 100644 --- a/view/jpa/pom.xml +++ b/view/jpa/pom.xml @@ -6,7 +6,7 @@ io.holunda.polyflow polyflow-view-parent - 4.3.0 + 4.4.0 polyflow-view-jpa diff --git a/view/jpa/src/main/kotlin/io/holunda/polyflow/view/jpa/JpaPolyflowViewDataEntryService.kt b/view/jpa/src/main/kotlin/io/holunda/polyflow/view/jpa/JpaPolyflowViewDataEntryService.kt index 2b8db49af..d37b47696 100644 --- a/view/jpa/src/main/kotlin/io/holunda/polyflow/view/jpa/JpaPolyflowViewDataEntryService.kt +++ b/view/jpa/src/main/kotlin/io/holunda/polyflow/view/jpa/JpaPolyflowViewDataEntryService.kt @@ -1,6 +1,7 @@ package io.holunda.polyflow.view.jpa import com.fasterxml.jackson.databind.ObjectMapper +import io.github.oshai.kotlinlogging.KotlinLogging import io.holixon.axon.gateway.query.QueryResponseMessageResponseType import io.holixon.axon.gateway.query.RevisionValue import io.holunda.camunda.taskpool.api.business.DataEntryAnonymizedEvent @@ -22,7 +23,6 @@ import io.holunda.polyflow.view.jpa.data.DataEntryRepository.Companion.isAuthori import io.holunda.polyflow.view.jpa.update.updateDataEntryQuery import io.holunda.polyflow.view.query.PageableSortableQuery import io.holunda.polyflow.view.query.data.* -import mu.KLogging import org.axonframework.config.ProcessingGroup import org.axonframework.eventhandling.EventHandler import org.axonframework.eventhandling.Timestamp @@ -35,6 +35,8 @@ import org.springframework.data.repository.findByIdOrNull import org.springframework.stereotype.Component import java.time.Instant +private val logger = KotlinLogging.logger {} + /** * Implementation of the Polyflow Data Entry View API using JPA to create the persistence model. */ @@ -47,7 +49,7 @@ class JpaPolyflowViewDataEntryService( val polyflowJpaViewProperties: PolyflowJpaViewProperties ) : DataEntryApi, DataEntryEventHandler { - companion object : KLogging() { + companion object { const val PROCESSING_GROUP = "io.holunda.polyflow.view.jpa.service.data" } diff --git a/view/jpa/src/main/kotlin/io/holunda/polyflow/view/jpa/JpaPolyflowViewProcessDefinitionService.kt b/view/jpa/src/main/kotlin/io/holunda/polyflow/view/jpa/JpaPolyflowViewProcessDefinitionService.kt index 7831c0da5..3839102a1 100644 --- a/view/jpa/src/main/kotlin/io/holunda/polyflow/view/jpa/JpaPolyflowViewProcessDefinitionService.kt +++ b/view/jpa/src/main/kotlin/io/holunda/polyflow/view/jpa/JpaPolyflowViewProcessDefinitionService.kt @@ -1,5 +1,6 @@ package io.holunda.polyflow.view.jpa +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.camunda.taskpool.api.process.definition.ProcessDefinitionRegisteredEvent import io.holunda.polyflow.view.ProcessDefinition import io.holunda.polyflow.view.jpa.JpaPolyflowViewProcessDefinitionService.Companion.PROCESSING_GROUP @@ -14,13 +15,14 @@ import io.holunda.polyflow.view.jpa.process.toProcessDefinition import io.holunda.polyflow.view.jpa.update.updateProcessDefinitionQuery import io.holunda.polyflow.view.query.process.ProcessDefinitionApi import io.holunda.polyflow.view.query.process.ProcessDefinitionsStartableByUserQuery -import mu.KLogging import org.axonframework.config.ProcessingGroup import org.axonframework.eventhandling.EventHandler import org.axonframework.queryhandling.QueryHandler import org.axonframework.queryhandling.QueryUpdateEmitter import org.springframework.stereotype.Component +private val logger = KotlinLogging.logger {} + /** * Implementation of the Polyflow Process Definition View API using JPA to create the persistence model. */ @@ -32,7 +34,7 @@ class JpaPolyflowViewProcessDefinitionService( val polyflowJpaViewProperties: PolyflowJpaViewProperties ) : ProcessDefinitionApi { - companion object : KLogging() { + companion object { const val PROCESSING_GROUP = "io.holunda.polyflow.view.jpa.service.process.definition" } diff --git a/view/jpa/src/main/kotlin/io/holunda/polyflow/view/jpa/JpaPolyflowViewProcessInstanceService.kt b/view/jpa/src/main/kotlin/io/holunda/polyflow/view/jpa/JpaPolyflowViewProcessInstanceService.kt index 44c727ebb..85147604a 100644 --- a/view/jpa/src/main/kotlin/io/holunda/polyflow/view/jpa/JpaPolyflowViewProcessInstanceService.kt +++ b/view/jpa/src/main/kotlin/io/holunda/polyflow/view/jpa/JpaPolyflowViewProcessInstanceService.kt @@ -1,5 +1,6 @@ package io.holunda.polyflow.view.jpa +import io.github.oshai.kotlinlogging.KotlinLogging import io.holixon.axon.gateway.query.QueryResponseMessageResponseType import io.holunda.camunda.taskpool.api.process.instance.* import io.holunda.polyflow.view.jpa.JpaPolyflowViewProcessInstanceService.Companion.PROCESSING_GROUP @@ -9,7 +10,6 @@ import io.holunda.polyflow.view.jpa.update.updateProcessInstanceQuery import io.holunda.polyflow.view.query.process.ProcessInstanceApi import io.holunda.polyflow.view.query.process.ProcessInstanceQueryResult import io.holunda.polyflow.view.query.process.ProcessInstancesByStateQuery -import mu.KLogging import org.axonframework.config.ProcessingGroup import org.axonframework.eventhandling.EventHandler import org.axonframework.queryhandling.QueryHandler @@ -17,6 +17,8 @@ import org.axonframework.queryhandling.QueryResponseMessage import org.axonframework.queryhandling.QueryUpdateEmitter import org.springframework.stereotype.Component +private val logger = KotlinLogging.logger {} + /** * Implementation of the Polyflow Process Instance View API using JPA to create the persistence model. */ @@ -28,7 +30,7 @@ class JpaPolyflowViewProcessInstanceService( val polyflowJpaViewProperties: PolyflowJpaViewProperties ) : ProcessInstanceApi { - companion object : KLogging() { + companion object { const val PROCESSING_GROUP = "io.holunda.polyflow.view.jpa.service.process.instance" } diff --git a/view/jpa/src/main/kotlin/io/holunda/polyflow/view/jpa/JpaPolyflowViewTaskService.kt b/view/jpa/src/main/kotlin/io/holunda/polyflow/view/jpa/JpaPolyflowViewTaskService.kt index 7a2e61179..caf415ebc 100644 --- a/view/jpa/src/main/kotlin/io/holunda/polyflow/view/jpa/JpaPolyflowViewTaskService.kt +++ b/view/jpa/src/main/kotlin/io/holunda/polyflow/view/jpa/JpaPolyflowViewTaskService.kt @@ -1,6 +1,7 @@ package io.holunda.polyflow.view.jpa import com.fasterxml.jackson.databind.ObjectMapper +import io.github.oshai.kotlinlogging.KotlinLogging import io.holixon.axon.gateway.query.RevisionValue import io.holunda.camunda.taskpool.api.task.* import io.holunda.polyflow.view.Task @@ -25,7 +26,6 @@ import io.holunda.polyflow.view.jpa.task.TaskRepository.Companion.isAuthorizedFo import io.holunda.polyflow.view.jpa.update.updateTaskQuery import io.holunda.polyflow.view.query.PageableSortableQuery import io.holunda.polyflow.view.query.task.* -import mu.KLogging import org.axonframework.config.ProcessingGroup import org.axonframework.eventhandling.EventHandler import org.axonframework.messaging.MetaData @@ -35,6 +35,8 @@ import org.springframework.data.repository.findByIdOrNull import org.springframework.stereotype.Component import java.util.* +private val logger = KotlinLogging.logger {} + /** * Implementation of the Polyflow Task View API using JPA to create the persistence model. */ @@ -48,7 +50,7 @@ class JpaPolyflowViewTaskService( val polyflowJpaViewProperties: PolyflowJpaViewProperties ) : TaskApi { - companion object : KLogging() { + companion object { const val PROCESSING_GROUP = "io.holunda.polyflow.view.jpa.service.task" } diff --git a/view/jpa/src/main/kotlin/io/holunda/polyflow/view/jpa/PolyflowJpaViewConfiguration.kt b/view/jpa/src/main/kotlin/io/holunda/polyflow/view/jpa/PolyflowJpaViewConfiguration.kt index d419861a3..ada15c7e5 100644 --- a/view/jpa/src/main/kotlin/io/holunda/polyflow/view/jpa/PolyflowJpaViewConfiguration.kt +++ b/view/jpa/src/main/kotlin/io/holunda/polyflow/view/jpa/PolyflowJpaViewConfiguration.kt @@ -1,7 +1,7 @@ package io.holunda.polyflow.view.jpa +import io.github.oshai.kotlinlogging.KotlinLogging import jakarta.annotation.PostConstruct -import mu.KLogging import org.axonframework.eventhandling.deadletter.jpa.DeadLetterEntry import org.axonframework.eventhandling.tokenstore.jpa.TokenEntry import org.axonframework.modelling.saga.repository.jpa.SagaEntry @@ -11,6 +11,8 @@ import org.springframework.context.annotation.ComponentScan import org.springframework.context.annotation.Configuration import org.springframework.data.jpa.repository.config.EnableJpaRepositories +private val logger = KotlinLogging.logger {} + /** * From here and below, scan for components, entities and JPA repositories. */ @@ -36,7 +38,6 @@ import org.springframework.data.jpa.repository.config.EnableJpaRepositories class PolyflowJpaViewConfiguration( val polyflowJpaViewProperties: PolyflowJpaViewProperties ) { - companion object : KLogging() /** * Logs a little. diff --git a/view/jpa/src/test/kotlin/io/holunda/polyflow/view/jpa/JpaPolyflowViewServiceDataEntryRevisionSupportITest.kt b/view/jpa/src/test/kotlin/io/holunda/polyflow/view/jpa/JpaPolyflowViewServiceDataEntryRevisionSupportITest.kt index 27bcc5d48..d7135cfbf 100644 --- a/view/jpa/src/test/kotlin/io/holunda/polyflow/view/jpa/JpaPolyflowViewServiceDataEntryRevisionSupportITest.kt +++ b/view/jpa/src/test/kotlin/io/holunda/polyflow/view/jpa/JpaPolyflowViewServiceDataEntryRevisionSupportITest.kt @@ -1,6 +1,7 @@ package io.holunda.polyflow.view.jpa import com.fasterxml.jackson.databind.ObjectMapper +import io.github.oshai.kotlinlogging.KotlinLogging import io.holixon.axon.gateway.query.QueryResponseMessageResponseType import io.holixon.axon.gateway.query.RevisionValue import io.holunda.camunda.taskpool.api.business.AuthorizationChange.Companion.addGroup @@ -16,7 +17,6 @@ import io.holunda.polyflow.view.query.data.DataEntriesForUserQuery import io.holunda.polyflow.view.query.data.DataEntriesQuery import io.holunda.polyflow.view.query.data.DataEntriesQueryResult import jakarta.transaction.Transactional -import mu.KLogging import org.assertj.core.api.Assertions.assertThat import org.axonframework.eventhandling.GenericEventMessage import org.axonframework.eventsourcing.eventstore.EventStore @@ -37,6 +37,8 @@ import java.util.concurrent.Callable import java.util.concurrent.ExecutorService import java.util.concurrent.Executors +private val logger = KotlinLogging.logger {} + @SpringBootTest( classes = [TestApplication::class], properties = [ @@ -49,8 +51,6 @@ import java.util.concurrent.Executors @ActiveProfiles("itest-tc-mariadb") internal class JpaPolyflowViewServiceDataEntryRevisionSupportITest { - companion object : KLogging() - lateinit var executorService: ExecutorService @Autowired diff --git a/view/mongo/pom.xml b/view/mongo/pom.xml index b368d1a41..1d27efec4 100644 --- a/view/mongo/pom.xml +++ b/view/mongo/pom.xml @@ -6,7 +6,7 @@ io.holunda.polyflow polyflow-view-parent - 4.3.0 + 4.4.0 polyflow-view-mongo diff --git a/view/mongo/src/main/kotlin/io/holunda/polyflow/view/mongo/MongoViewService.kt b/view/mongo/src/main/kotlin/io/holunda/polyflow/view/mongo/MongoViewService.kt index d6b7af642..6d08a6b09 100755 --- a/view/mongo/src/main/kotlin/io/holunda/polyflow/view/mongo/MongoViewService.kt +++ b/view/mongo/src/main/kotlin/io/holunda/polyflow/view/mongo/MongoViewService.kt @@ -1,5 +1,6 @@ package io.holunda.polyflow.view.mongo +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.camunda.taskpool.api.business.* import io.holunda.camunda.taskpool.api.task.* import io.holunda.polyflow.view.* @@ -13,7 +14,6 @@ import io.holunda.polyflow.view.query.data.* import io.holunda.polyflow.view.query.task.* import jakarta.annotation.PostConstruct import jakarta.annotation.PreDestroy -import mu.KLogging import org.axonframework.config.EventProcessingConfiguration import org.axonframework.config.ProcessingGroup import org.axonframework.eventhandling.EventHandler @@ -74,6 +74,8 @@ class MongoViewServiceConfiguration { ) } +private val logger = KotlinLogging.logger {} + /** * Mongo-based projection. */ @@ -93,7 +95,7 @@ class MongoViewService( private val clock: Clock ) : ReactiveTaskApi, ReactiveDataEntryApi { - companion object : KLogging() { + companion object { const val PROCESSING_GROUP = "io.holunda.camunda.taskpool.view.mongo.service" } diff --git a/view/mongo/src/main/kotlin/io/holunda/polyflow/view/mongo/TaskPoolMongoViewConfiguration.kt b/view/mongo/src/main/kotlin/io/holunda/polyflow/view/mongo/TaskPoolMongoViewConfiguration.kt index ff5e471e6..a0c96e179 100644 --- a/view/mongo/src/main/kotlin/io/holunda/polyflow/view/mongo/TaskPoolMongoViewConfiguration.kt +++ b/view/mongo/src/main/kotlin/io/holunda/polyflow/view/mongo/TaskPoolMongoViewConfiguration.kt @@ -1,8 +1,8 @@ package io.holunda.polyflow.view.mongo +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.polyflow.view.mongo.task.TaskDocument import jakarta.annotation.PostConstruct -import mu.KLogging import org.axonframework.eventhandling.tokenstore.TokenStore import org.axonframework.extensions.mongo.DefaultMongoTemplate import org.axonframework.extensions.mongo.MongoTemplate @@ -20,6 +20,8 @@ import org.springframework.data.mongodb.core.convert.MappingMongoConverter import org.springframework.data.mongodb.repository.config.EnableReactiveMongoRepositories import java.time.Clock +private val logger = KotlinLogging.logger {} + /** * Main configuration of the Mongo-DB based view. */ @@ -30,7 +32,7 @@ import java.time.Clock @EntityScan(basePackageClasses = [TaskDocument::class]) class TaskPoolMongoViewConfiguration { - companion object : KLogging() { + companion object { const val COLLECTION_TOKENS = "tracking-tokens" const val COLLECTION_EVENTS = "domain-events" const val COLLECTION_SAGAS = "sagas" diff --git a/view/mongo/src/main/kotlin/io/holunda/polyflow/view/mongo/data/DataEntryChangeTracker.kt b/view/mongo/src/main/kotlin/io/holunda/polyflow/view/mongo/data/DataEntryChangeTracker.kt index 4fc921e34..64941d2b0 100644 --- a/view/mongo/src/main/kotlin/io/holunda/polyflow/view/mongo/data/DataEntryChangeTracker.kt +++ b/view/mongo/src/main/kotlin/io/holunda/polyflow/view/mongo/data/DataEntryChangeTracker.kt @@ -1,12 +1,12 @@ package io.holunda.polyflow.view.mongo.data import com.mongodb.MongoCommandException +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.polyflow.view.DataEntry import io.holunda.polyflow.view.mongo.TaskPoolMongoViewProperties import io.holunda.polyflow.view.mongo.util.CronTriggerWithJitter import jakarta.annotation.PostConstruct import jakarta.annotation.PreDestroy -import mu.KLogging import org.bson.BsonValue import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty import org.springframework.scheduling.TaskScheduler @@ -24,6 +24,8 @@ import java.time.Instant import java.util.concurrent.TimeUnit import java.util.logging.Level +private val logger = KotlinLogging.logger {} + /** * Tracks changes of data entries. Also makes sure that data entries marked as deleted are 'really' deleted shortly after. * Only active if `polyflow.view.mongo.changeTrackingMode` is set to `CHANGE_STREAM`. @@ -36,8 +38,6 @@ class DataEntryChangeTracker( private val scheduler: TaskScheduler ) { - companion object : KLogging() - private var lastSeenResumeToken: BsonValue? = null private val changeStream: Flux = Flux diff --git a/view/mongo/src/main/kotlin/io/holunda/polyflow/view/mongo/process/ProcessDefinitionMongoService.kt b/view/mongo/src/main/kotlin/io/holunda/polyflow/view/mongo/process/ProcessDefinitionMongoService.kt index 96d2373c8..3a76886ef 100644 --- a/view/mongo/src/main/kotlin/io/holunda/polyflow/view/mongo/process/ProcessDefinitionMongoService.kt +++ b/view/mongo/src/main/kotlin/io/holunda/polyflow/view/mongo/process/ProcessDefinitionMongoService.kt @@ -1,10 +1,10 @@ package io.holunda.polyflow.view.mongo.process +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.camunda.taskpool.api.process.definition.ProcessDefinitionRegisteredEvent import io.holunda.polyflow.view.ProcessDefinition import io.holunda.polyflow.view.query.process.ProcessDefinitionsStartableByUserQuery import io.holunda.polyflow.view.query.process.ReactiveProcessDefinitionApi -import mu.KLogging import org.axonframework.eventhandling.EventHandler import org.axonframework.messaging.MetaData import org.axonframework.queryhandling.QueryHandler @@ -12,6 +12,8 @@ import org.axonframework.queryhandling.QueryUpdateEmitter import org.springframework.stereotype.Component import java.util.concurrent.CompletableFuture +private val logger = KotlinLogging.logger {} + /** * Mongo process definition projection. */ @@ -21,8 +23,6 @@ class ProcessDefinitionMongoService( private val processDefinitionRepository: ProcessDefinitionRepository ) : ReactiveProcessDefinitionApi { - companion object : KLogging() - /** * On new process definition. */ diff --git a/view/mongo/src/main/kotlin/io/holunda/polyflow/view/mongo/task/TaskChangeTracker.kt b/view/mongo/src/main/kotlin/io/holunda/polyflow/view/mongo/task/TaskChangeTracker.kt index 8abb99b13..708455347 100644 --- a/view/mongo/src/main/kotlin/io/holunda/polyflow/view/mongo/task/TaskChangeTracker.kt +++ b/view/mongo/src/main/kotlin/io/holunda/polyflow/view/mongo/task/TaskChangeTracker.kt @@ -1,6 +1,7 @@ package io.holunda.polyflow.view.mongo.task import com.mongodb.MongoCommandException +import io.github.oshai.kotlinlogging.KotlinLogging import io.holunda.camunda.taskpool.api.business.dataIdentityString import io.holunda.polyflow.view.Task import io.holunda.polyflow.view.TaskWithDataEntries @@ -11,7 +12,6 @@ import io.holunda.polyflow.view.mongo.util.CronTriggerWithJitter import io.holunda.polyflow.view.query.task.ApplicationWithTaskCount import jakarta.annotation.PostConstruct import jakarta.annotation.PreDestroy -import mu.KLogging import org.bson.BsonValue import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty import org.springframework.scheduling.TaskScheduler @@ -29,6 +29,8 @@ import java.time.Instant import java.util.concurrent.TimeUnit import java.util.logging.Level +private val logger = KotlinLogging.logger {} + /** * Observes the change stream on the mongo db and provides `Flux`es of changes for the various result types of queries. Also makes sure that tasks marked as * deleted are 'really' deleted shortly after. @@ -42,7 +44,6 @@ class TaskChangeTracker( private val properties: TaskPoolMongoViewProperties, private val scheduler: TaskScheduler ) { - companion object : KLogging() private var lastSeenResumeToken: BsonValue? = null diff --git a/view/mongo/src/main/kotlin/io/holunda/polyflow/view/mongo/task/TaskRepositoryExtensionImpl.kt b/view/mongo/src/main/kotlin/io/holunda/polyflow/view/mongo/task/TaskRepositoryExtensionImpl.kt index aad1bb9b7..f1cfd0f02 100644 --- a/view/mongo/src/main/kotlin/io/holunda/polyflow/view/mongo/task/TaskRepositoryExtensionImpl.kt +++ b/view/mongo/src/main/kotlin/io/holunda/polyflow/view/mongo/task/TaskRepositoryExtensionImpl.kt @@ -3,7 +3,6 @@ package io.holunda.polyflow.view.mongo.task import io.holunda.polyflow.view.mongo.changeStreamOptions import io.holunda.polyflow.view.mongo.data.DataEntryDocument.Companion.authorizedPrincipals import io.holunda.polyflow.view.query.task.ApplicationWithTaskCount -import mu.KLogging import org.bson.BsonValue import org.springframework.data.domain.Pageable import org.springframework.data.mongodb.core.ChangeStreamEvent @@ -24,8 +23,6 @@ open class TaskRepositoryExtensionImpl( private val mongoTemplate: ReactiveMongoTemplate ) : TaskRepositoryExtension { - companion object : KLogging() - private val notDeleted = match(where("deleted").ne(true)) private val countGroupedByApplicationName = arrayOf( diff --git a/view/mongo/src/main/kotlin/io/holunda/polyflow/view/mongo/task/TaskWithDataEntriesRepositoryExtensionImpl.kt b/view/mongo/src/main/kotlin/io/holunda/polyflow/view/mongo/task/TaskWithDataEntriesRepositoryExtensionImpl.kt index 82bd7fcf9..d3620ec0d 100644 --- a/view/mongo/src/main/kotlin/io/holunda/polyflow/view/mongo/task/TaskWithDataEntriesRepositoryExtensionImpl.kt +++ b/view/mongo/src/main/kotlin/io/holunda/polyflow/view/mongo/task/TaskWithDataEntriesRepositoryExtensionImpl.kt @@ -1,9 +1,11 @@ package io.holunda.polyflow.view.mongo.task import io.holunda.polyflow.view.auth.User -import io.holunda.polyflow.view.filter.* +import io.holunda.polyflow.view.filter.Criterion +import io.holunda.polyflow.view.filter.EQUALS +import io.holunda.polyflow.view.filter.GREATER +import io.holunda.polyflow.view.filter.LESS import io.holunda.polyflow.view.mongo.data.DataEntryDocument -import mu.KLogging import org.springframework.data.domain.Pageable import org.springframework.data.domain.Sort import org.springframework.data.mongodb.core.ReactiveMongoTemplate @@ -19,11 +21,10 @@ open class TaskWithDataEntriesRepositoryExtensionImpl( private val mongoTemplate: ReactiveMongoTemplate ) : TaskWithDataEntriesRepositoryExtension { - companion object : KLogging() { + companion object { val DEFAULT_SORT = Sort.by(Sort.Direction.DESC, TaskWithDataEntriesDocument::dueDate.name) } - /** * Retrieves a list of tasks for user matching provided criteria.

diff --git a/view/mongo/src/test/kotlin/io/holunda/polyflow/view/mongo/service/PolyflowStages.kt b/view/mongo/src/test/kotlin/io/holunda/polyflow/view/mongo/service/PolyflowStages.kt
index ba6a2325c..8ac405f67 100644
--- a/view/mongo/src/test/kotlin/io/holunda/polyflow/view/mongo/service/PolyflowStages.kt
+++ b/view/mongo/src/test/kotlin/io/holunda/polyflow/view/mongo/service/PolyflowStages.kt
@@ -3,6 +3,7 @@ package io.holunda.polyflow.view.mongo.service
 import com.tngtech.jgiven.Stage
 import com.tngtech.jgiven.annotation.*
 import com.tngtech.jgiven.integration.spring.JGivenStage
+import io.github.oshai.kotlinlogging.KotlinLogging
 import io.holunda.camunda.taskpool.api.business.DataEntryAnonymizedEvent
 import io.holunda.camunda.taskpool.api.business.DataEntryCreatedEvent
 import io.holunda.camunda.taskpool.api.business.DataEntryDeletedEvent
@@ -17,7 +18,6 @@ import io.holunda.polyflow.view.query.data.DataEntriesForUserQuery
 import io.holunda.polyflow.view.query.data.DataEntryForIdentityQuery
 import io.holunda.polyflow.view.query.task.*
 import io.toolisticon.testing.jgiven.step
-import mu.KLogging
 import org.assertj.core.api.Assertions.assertThat
 import org.awaitility.Awaitility
 import org.awaitility.core.ConditionTimeoutException
@@ -32,8 +32,9 @@ import org.springframework.beans.factory.annotation.Autowired
 import java.util.concurrent.TimeUnit
 import java.util.function.Predicate
 
+private val logger = KotlinLogging.logger {}
+
 abstract class PolyflowStage> : Stage() {
-  companion object : KLogging()
 
   @Autowired
   @ScenarioState
diff --git a/view/pom.xml b/view/pom.xml
index caac2b215..aec0f3ac9 100644
--- a/view/pom.xml
+++ b/view/pom.xml
@@ -6,7 +6,7 @@
   
     io.holunda.polyflow
     polyflow-parent
-    4.3.0
+    4.4.0
     ../bom/parent/pom.xml
   
 
diff --git a/view/simple/pom.xml b/view/simple/pom.xml
index 0c65e42c7..091806266 100755
--- a/view/simple/pom.xml
+++ b/view/simple/pom.xml
@@ -6,7 +6,7 @@
   
     io.holunda.polyflow
     polyflow-view-parent
-    4.3.0
+    4.4.0
   
 
   polyflow-view-simple
diff --git a/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/TaskPoolSimpleViewConfiguration.kt b/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/TaskPoolSimpleViewConfiguration.kt
index 8c6e9f477..d8749ddbf 100755
--- a/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/TaskPoolSimpleViewConfiguration.kt
+++ b/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/TaskPoolSimpleViewConfiguration.kt
@@ -1,10 +1,10 @@
 package io.holunda.polyflow.view.simple
 
+import io.github.oshai.kotlinlogging.KotlinLogging
 import io.holunda.polyflow.view.query.FilterQuery
 import io.holunda.polyflow.view.query.QueryResult
 import io.holunda.polyflow.view.simple.service.SimpleServiceViewProcessingGroup
 import jakarta.annotation.PostConstruct
-import mu.KLogging
 import org.axonframework.config.EventProcessingConfigurer
 import org.axonframework.eventhandling.tokenstore.inmemory.InMemoryTokenStore
 import org.axonframework.queryhandling.QueryUpdateEmitter
@@ -12,6 +12,8 @@ import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.context.annotation.ComponentScan
 import org.springframework.context.annotation.Configuration
 
+private val logger = KotlinLogging.logger {}
+
 /**
  * Configuration for in-memory polyflow view.
  */
@@ -19,8 +21,6 @@ import org.springframework.context.annotation.Configuration
 @Configuration
 class TaskPoolSimpleViewConfiguration {
 
-  companion object : KLogging()
-
   /**
    * Configures the in-memory (simple) view to use an in-memory token store, to make sure that the
    * token and the projection are stored in the same place.
diff --git a/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/service/RevisionSupport.kt b/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/service/RevisionSupport.kt
index 5ebc7db3d..aa149b7a4 100644
--- a/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/service/RevisionSupport.kt
+++ b/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/service/RevisionSupport.kt
@@ -1,16 +1,16 @@
 package io.holunda.polyflow.view.simple.service
 
+import io.github.oshai.kotlinlogging.KotlinLogging
 import io.holixon.axon.gateway.query.RevisionValue
-import mu.KLogging
 import java.util.concurrent.ConcurrentHashMap
 
+private val logger = KotlinLogging.logger {}
+
 /**
  * Helper to create revision supported projection.
  */
 class RevisionSupport {
 
-  companion object : KLogging()
-
   private val revisionInfo = ConcurrentHashMap()
 
   /**
diff --git a/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/service/SimpleDataEntryService.kt b/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/service/SimpleDataEntryService.kt
index f98f7be90..dc7293462 100644
--- a/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/service/SimpleDataEntryService.kt
+++ b/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/service/SimpleDataEntryService.kt
@@ -1,5 +1,6 @@
 package io.holunda.polyflow.view.simple.service
 
+import io.github.oshai.kotlinlogging.KotlinLogging
 import io.holixon.axon.gateway.query.QueryResponseMessageResponseType
 import io.holixon.axon.gateway.query.RevisionValue
 import io.holunda.camunda.taskpool.api.business.*
@@ -9,7 +10,6 @@ import io.holunda.polyflow.view.filter.filterByPredicate
 import io.holunda.polyflow.view.filter.toCriteria
 import io.holunda.polyflow.view.query.data.*
 import io.holunda.polyflow.view.sort.dataComparator
-import mu.KLogging
 import org.axonframework.config.ProcessingGroup
 import org.axonframework.eventhandling.EventHandler
 import org.axonframework.messaging.MetaData
@@ -17,9 +17,10 @@ import org.axonframework.queryhandling.QueryHandler
 import org.axonframework.queryhandling.QueryResponseMessage
 import org.axonframework.queryhandling.QueryUpdateEmitter
 import org.springframework.stereotype.Component
-import java.util.*
 import java.util.concurrent.ConcurrentHashMap
 
+private val logger = KotlinLogging.logger {}
+
 /**
  * Data entry in-memory projection.
  */
@@ -31,8 +32,6 @@ class SimpleDataEntryService(
   private val dataEntries: ConcurrentHashMap = ConcurrentHashMap()
 ) : DataEntryApi {
 
-  companion object : KLogging()
-
   /**
    * Creates new data entry.
    */
diff --git a/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/service/SimpleProcessDefinitionService.kt b/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/service/SimpleProcessDefinitionService.kt
index c2b3db007..673489115 100644
--- a/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/service/SimpleProcessDefinitionService.kt
+++ b/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/service/SimpleProcessDefinitionService.kt
@@ -1,11 +1,10 @@
 package io.holunda.polyflow.view.simple.service
 
+import io.github.oshai.kotlinlogging.KotlinLogging
 import io.holunda.camunda.taskpool.api.process.definition.ProcessDefinitionRegisteredEvent
-import io.holunda.polyflow.view.DataEntry
 import io.holunda.polyflow.view.ProcessDefinition
 import io.holunda.polyflow.view.query.process.ProcessDefinitionApi
 import io.holunda.polyflow.view.query.process.ProcessDefinitionsStartableByUserQuery
-import mu.KLogging
 import org.axonframework.config.ProcessingGroup
 import org.axonframework.eventhandling.EventHandler
 import org.axonframework.queryhandling.QueryHandler
@@ -14,6 +13,8 @@ import org.springframework.stereotype.Component
 import java.util.*
 import java.util.concurrent.ConcurrentHashMap
 
+private val logger = KotlinLogging.logger {}
+
 /**
  * Simple projection for process definitions.
  */
@@ -24,8 +25,6 @@ class SimpleProcessDefinitionService(
   private val processDefinitions: MutableMap> = ConcurrentHashMap()
 ) : ProcessDefinitionApi {
 
-  companion object : KLogging()
-
   /**
    * React on process definition registration.
    */
diff --git a/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/service/SimpleProcessInstanceService.kt b/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/service/SimpleProcessInstanceService.kt
index 7c38a0cac..438d50d63 100644
--- a/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/service/SimpleProcessInstanceService.kt
+++ b/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/service/SimpleProcessInstanceService.kt
@@ -1,5 +1,6 @@
 package io.holunda.polyflow.view.simple.service
 
+import io.github.oshai.kotlinlogging.KotlinLogging
 import io.holixon.axon.gateway.query.QueryResponseMessageResponseType
 import io.holixon.axon.gateway.query.RevisionValue
 import io.holunda.camunda.taskpool.api.process.instance.*
@@ -8,7 +9,6 @@ import io.holunda.polyflow.view.ProcessInstanceState
 import io.holunda.polyflow.view.query.process.ProcessInstanceApi
 import io.holunda.polyflow.view.query.process.ProcessInstanceQueryResult
 import io.holunda.polyflow.view.query.process.ProcessInstancesByStateQuery
-import mu.KLogging
 import org.axonframework.config.ProcessingGroup
 import org.axonframework.eventhandling.EventHandler
 import org.axonframework.messaging.MetaData
@@ -18,6 +18,8 @@ import org.axonframework.queryhandling.QueryUpdateEmitter
 import org.springframework.stereotype.Component
 import java.util.concurrent.ConcurrentHashMap
 
+private val logger = KotlinLogging.logger {}
+
 /**
  * In-memory process instance projection.
  */
@@ -29,8 +31,6 @@ class SimpleProcessInstanceService(
   private val processInstances: ConcurrentHashMap = ConcurrentHashMap()
 ) : ProcessInstanceApi {
 
-  companion object : KLogging()
-
   /**
    * Query by the state.
    */
diff --git a/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/service/SimpleProcessVariableService.kt b/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/service/SimpleProcessVariableService.kt
index 5ea05b447..fb85640b7 100644
--- a/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/service/SimpleProcessVariableService.kt
+++ b/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/service/SimpleProcessVariableService.kt
@@ -1,5 +1,6 @@
 package io.holunda.polyflow.view.simple.service
 
+import io.github.oshai.kotlinlogging.KotlinLogging
 import io.holixon.axon.gateway.query.QueryResponseMessageResponseType
 import io.holixon.axon.gateway.query.RevisionValue
 import io.holunda.camunda.taskpool.api.process.variable.ProcessVariableCreate
@@ -10,7 +11,6 @@ import io.holunda.polyflow.view.ProcessVariable
 import io.holunda.polyflow.view.query.process.variable.ProcessVariableApi
 import io.holunda.polyflow.view.query.process.variable.ProcessVariableQueryResult
 import io.holunda.polyflow.view.query.process.variable.ProcessVariablesForInstanceQuery
-import mu.KLogging
 import org.axonframework.config.ProcessingGroup
 import org.axonframework.eventhandling.EventHandler
 import org.axonframework.messaging.MetaData
@@ -20,6 +20,8 @@ import org.axonframework.queryhandling.QueryUpdateEmitter
 import org.springframework.stereotype.Component
 import java.util.concurrent.ConcurrentHashMap
 
+private val logger = KotlinLogging.logger {}
+
 /**
  * In-memory process instance projection.
  */
@@ -31,8 +33,6 @@ class SimpleProcessVariableService(
   private val processVariables: ConcurrentHashMap> = ConcurrentHashMap>()
 ) : ProcessVariableApi {
 
-  companion object : KLogging()
-
   /**
    * Query for process variables of a process instance.
    */
diff --git a/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/service/SimpleServiceViewProcessingGroup.kt b/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/service/SimpleServiceViewProcessingGroup.kt
index dd51285e3..4f6ca26bd 100644
--- a/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/service/SimpleServiceViewProcessingGroup.kt
+++ b/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/service/SimpleServiceViewProcessingGroup.kt
@@ -1,10 +1,12 @@
 package io.holunda.polyflow.view.simple.service
 
-import mu.KLogging
+import io.github.oshai.kotlinlogging.KotlinLogging
 import org.axonframework.config.EventProcessingConfiguration
 import org.axonframework.eventhandling.TrackingEventProcessor
 import org.springframework.stereotype.Component
 
+private val logger = KotlinLogging.logger {}
+
 /**
  * Component responsible for offering replay functionality of the processor.
  */
@@ -13,7 +15,7 @@ class SimpleServiceViewProcessingGroup(
   private val configuration: EventProcessingConfiguration
 ) {
 
-  companion object : KLogging() {
+  companion object {
     const val PROCESSING_GROUP = "io.holunda.polyflow.view.simple"
   }
 
@@ -24,7 +26,7 @@ class SimpleServiceViewProcessingGroup(
     this.configuration
       .eventProcessorByProcessingGroup(PROCESSING_GROUP, TrackingEventProcessor::class.java)
       .ifPresent {
-        SimpleTaskPoolService.logger.info { "VIEW-SIMPLE-002: Starting simple view event replay." }
+        logger.info { "VIEW-SIMPLE-002: Starting simple view event replay." }
         it.shutDown()
         it.resetTokens()
         it.start()
diff --git a/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/service/SimpleTaskPoolService.kt b/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/service/SimpleTaskPoolService.kt
index 1bcabeb2f..01404399b 100755
--- a/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/service/SimpleTaskPoolService.kt
+++ b/view/simple/src/main/kotlin/io/holunda/polyflow/view/simple/service/SimpleTaskPoolService.kt
@@ -1,5 +1,6 @@
 package io.holunda.polyflow.view.simple.service
 
+import io.github.oshai.kotlinlogging.KotlinLogging
 import io.holunda.camunda.taskpool.api.business.*
 import io.holunda.camunda.taskpool.api.task.*
 import io.holunda.polyflow.view.DataEntry
@@ -8,13 +9,11 @@ import io.holunda.polyflow.view.TaskWithDataEntries
 import io.holunda.polyflow.view.filter.createTaskPredicates
 import io.holunda.polyflow.view.filter.filterByPredicate
 import io.holunda.polyflow.view.filter.toCriteria
-import io.holunda.polyflow.view.filter.toPayloadPredicates
 import io.holunda.polyflow.view.query.task.*
 import io.holunda.polyflow.view.simple.updateMapFilterQuery
 import io.holunda.polyflow.view.sort.taskComparator
 import io.holunda.polyflow.view.sort.taskWithDataEntriesComparator
 import io.holunda.polyflow.view.task
-import mu.KLogging
 import org.axonframework.config.ProcessingGroup
 import org.axonframework.eventhandling.EventHandler
 import org.axonframework.queryhandling.QueryHandler
@@ -24,6 +23,8 @@ import org.springframework.stereotype.Component
 import java.util.*
 import java.util.concurrent.ConcurrentHashMap
 
+private val logger = KotlinLogging.logger {}
+
 /**
  * Simple in-memory implementation of the Task API.
  */
@@ -35,8 +36,6 @@ class SimpleTaskPoolService(
   private val dataEntries: ConcurrentHashMap = ConcurrentHashMap()
 ) : TaskApi {
 
-  companion object : KLogging()
-
   /**
    * Retrieves a task for given task id.
    */
@@ -105,7 +104,7 @@ class SimpleTaskPoolService(
 
     val predicates = createTaskPredicates(toCriteria(query.filters))
 
-    val filtered = tasks.values.filter { TasksForUserQuery(user = query.user, assignedToMeOnly = query.assignedToMeOnly ).applyFilter(it) }
+    val filtered = tasks.values.filter { TasksForUserQuery(user = query.user, assignedToMeOnly = query.assignedToMeOnly).applyFilter(it) }
       .asSequence()
       .map { task -> TaskWithDataEntries.correlate(task, dataEntries) }
       .filter { filterByPredicate(it, predicates) }
@@ -211,7 +210,7 @@ class SimpleTaskPoolService(
 
     val distinctFilteredKeys = tasks.values.asSequence()
       .filter { !filterAssignee || it.assignee == query.user!!.username }
-      .filter { task -> !filterCandidates || (task.candidateUsers.contains(query.user!!.username) || task.candidateGroups.any { query.user!!.groups.contains(it) } ) }
+      .filter { task -> !filterCandidates || (task.candidateUsers.contains(query.user!!.username) || task.candidateGroups.any { query.user!!.groups.contains(it) }) }
       .map(Task::payload)
       .flatMap(VariableMap::keys)
       .distinct()
@@ -233,7 +232,7 @@ class SimpleTaskPoolService(
 
     val distinctFilteredValues = tasks.values.asSequence()
       .filter { !filterAssignee || it.assignee == query.user!!.username }
-      .filter { task -> !filterCandidates || (task.candidateUsers.contains(query.user!!.username) || task.candidateGroups.any { query.user!!.groups.contains(it) } ) }
+      .filter { task -> !filterCandidates || (task.candidateUsers.contains(query.user!!.username) || task.candidateGroups.any { query.user!!.groups.contains(it) }) }
       .map(Task::payload)
       .filter { it.containsKey(query.attributeName) }
       .mapNotNull { it[query.attributeName] }
diff --git a/view/view-api-client/pom.xml b/view/view-api-client/pom.xml
index 718ae531e..55465788d 100755
--- a/view/view-api-client/pom.xml
+++ b/view/view-api-client/pom.xml
@@ -6,7 +6,7 @@
   
     io.holunda.polyflow
     polyflow-view-parent
-    4.3.0
+    4.4.0
   
 
   polyflow-view-api-client
diff --git a/view/view-api/pom.xml b/view/view-api/pom.xml
index 8e0013003..f24ee1139 100755
--- a/view/view-api/pom.xml
+++ b/view/view-api/pom.xml
@@ -6,7 +6,7 @@
   
     io.holunda.polyflow
     polyflow-view-parent
-    4.3.0
+    4.4.0
   
 
   polyflow-view-api