Skip to content

Commit

Permalink
init kafka
Browse files Browse the repository at this point in the history
  • Loading branch information
zambrovski authored and p-wunderlich committed Oct 10, 2023
1 parent 6f96fad commit c21e80b
Show file tree
Hide file tree
Showing 6 changed files with 440 additions and 0 deletions.
38 changes: 38 additions & 0 deletions scenarios/distributed-kafka/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-example-scenario-root</artifactId>
<version>3.8.3-SNAPSHOT</version>
</parent>

<artifactId>polyflow-example-scenario-distributed-kafka</artifactId>
<name>POM: examples/${project.artifactId}</name>
<packaging>pom</packaging>

<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

<modules>
<module>process-application-local-polyflow</module>
<module>process-platform-view-only</module>
</modules>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.axonframework</groupId>
<artifactId>axon-server-connector</artifactId>
<version>4.6.7</version>
<scope>runtime</scope>
</dependency>

</dependencies>

</dependencyManagement>

</project>
130 changes: 130 additions & 0 deletions scenarios/distributed-kafka/process-application-local-polyflow/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-example-scenario-distributed-kafka</artifactId>
<version>3.8.3-SNAPSHOT</version>
</parent>

<artifactId>example-distributed-kafka-process-application-local-polyflow</artifactId>
<name>examples/${project.artifactId}</name>

<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

<dependencies>

<dependency>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-example-approval-backend</artifactId>
</dependency>
<dependency>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-taskpool-core</artifactId>
</dependency>
<dependency>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-datapool-core</artifactId>
</dependency>

<dependency>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-camunda-bpm-taskpool-job-sender</artifactId>
</dependency>

<!-- DB and Flyway -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>

<dependency>
<groupId>io.holunda</groupId>
<artifactId>camunda-platform-7-autologin</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<!-- kotlin compiler -->
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
</plugin>
<!-- java compiler -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<!-- for packaging springboot application -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<requiresUnpack>
<dependency>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-example-approval-backend</artifactId>
</dependency>
</requiresUnpack>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>frontend</id>
<activation>
<property>
<name>!skipFrontend</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-example-approval-forms</artifactId>
</dependency>
</dependencies>
</profile>

<profile>
<id>camunda-ce</id>
<activation>
<property>
<name>!camunda-ee</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>
</dependency>
</dependencies>
</profile>
<profile>
<id>camunda-ee</id>
<activation>
<property>
<name>camunda-ee</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter-webapp-ee</artifactId>
</dependency>
</dependencies>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package io.holunda.polyflow.example.process.approval

import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.SerializationFeature
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.thoughtworks.xstream.XStream
import com.thoughtworks.xstream.security.AnyTypePermission
import io.holunda.polyflow.bus.jackson.config.FallbackPayloadObjectMapperAutoConfiguration.Companion.PAYLOAD_OBJECT_MAPPER
import io.holunda.polyflow.bus.jackson.configurePolyflowJacksonObjectMapper
import io.holunda.polyflow.datapool.core.EnablePolyflowDataPool
import io.holunda.polyflow.taskpool.core.EnablePolyflowTaskPool
import org.axonframework.commandhandling.CommandBus
import org.axonframework.commandhandling.gateway.CommandGateway
import org.axonframework.commandhandling.gateway.DefaultCommandGateway
import org.axonframework.eventhandling.deadletter.jpa.DeadLetterEventEntry
import org.axonframework.eventhandling.tokenstore.jpa.TokenEntry
import org.axonframework.modelling.saga.repository.jpa.SagaEntry
import org.axonframework.serialization.xml.CompactDriver
import org.axonframework.springboot.util.ConditionalOnMissingQualifiedBean
import org.axonframework.springboot.util.XStreamSecurityTypeUtility
import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.boot.SpringApplication
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.boot.autoconfigure.domain.EntityScan
import org.springframework.context.ApplicationContext
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Import
import org.springframework.context.annotation.Primary

/**
* Starts example application approval process.
*/
fun main(args: Array<String>) {
SpringApplication.run(ExampleProcessApplicationLocalPolyflowDistributedWithKafka::class.java, *args)
}

/**
* Process application approval only.
* Includes:
* - approval-process-backend
* - taskpool-core
* - datapool-core
*/
@SpringBootApplication
@EnablePolyflowDataPool
@EnablePolyflowTaskPool
@Import(RequestApprovalProcessConfiguration::class)
@EntityScan(
basePackageClasses = [
TokenEntry::class,
SagaEntry::class,
DeadLetterEventEntry::class
]
)
class ExampleProcessApplicationLocalPolyflowDistributedWithKafka {

@Bean
fun objectMapper(): ObjectMapper {
return jacksonObjectMapper()
.registerModule(JavaTimeModule())
.configurePolyflowJacksonObjectMapper()
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
}

@Bean("defaultAxonXStream")
@ConditionalOnMissingBean
fun defaultAxonXStream(applicationContext: ApplicationContext): XStream {
val xStream = XStream(CompactDriver())
xStream.allowTypesByWildcard(XStreamSecurityTypeUtility.autoConfigBasePackages(applicationContext))
// This configures XStream to permit any class to be deserialized.
// FIXME: We might want to make this more restrictive to improve security
xStream.addPermission(AnyTypePermission.ANY)
return xStream
}

/*
@Bean
@Primary
@ConditionalOnMissingQualifiedBean(beanClass = CommandGateway::class, qualifier = "unqualified")
fun defaultCommandGateway(bus: CommandBus): CommandGateway = DefaultCommandGateway.builder().commandBus(bus).build()
*/

}
96 changes: 96 additions & 0 deletions scenarios/distributed-kafka/process-platform-view-only/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-example-scenario-distributed-kafka</artifactId>
<version>3.8.3-SNAPSHOT</version>
</parent>

<artifactId>example-distributed-kafka-process-platform-view-only</artifactId>
<name>examples/${project.artifactId}</name>

<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

<dependencies>
<dependency>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-example-tasklist-backend</artifactId>
</dependency>
<dependency>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-form-url-resolver</artifactId>
</dependency>
<dependency>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-view-jpa</artifactId>
</dependency>

<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>

<!-- Axon -->
<dependency>
<groupId>org.axonframework</groupId>
<artifactId>axon-spring-boot-starter</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Jackson -->
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-kotlin</artifactId>
</dependency>
<!-- Spring-Doc -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<!-- for packaging springboot application -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>frontend</id>
<activation>
<property>
<name>!skipFrontend</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-example-tasklist-angular</artifactId>
</dependency>
</dependencies>
</profile>
</profiles>

</project>
Loading

0 comments on commit c21e80b

Please sign in to comment.