File tree Expand file tree Collapse file tree 13 files changed +164
-2
lines changed
infinitic-spring-boot-3-example
kotlin/com/tiarebalbi/example
infinitic-spring-boot-3-starter
kotlin/com/tiarebalbi/infinitic/spring Expand file tree Collapse file tree 13 files changed +164
-2
lines changed Original file line number Diff line number Diff line change 1+ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+
3+ plugins {
4+ id(" org.springframework.boot" ) version " 3.1.4"
5+ id(" io.spring.dependency-management" ) version " 1.1.3"
6+ kotlin(" jvm" ) version " 1.8.22"
7+ kotlin(" plugin.spring" ) version " 1.8.22"
8+ }
9+
10+ group = " com.tiarebalbi.example"
11+ version = " 0.0.1-SNAPSHOT"
12+ extra[" infiniticVersion" ] = " 0.11.6"
13+
14+ java {
15+ sourceCompatibility = JavaVersion .VERSION_17
16+ }
17+
18+ repositories {
19+ mavenCentral()
20+ }
21+
22+ dependencies {
23+ api(project(" :infinitic-spring-boot-3-starter" ))
24+ implementation(" io.infinitic:infinitic-inMemory:${project.extra[" infiniticVersion" ]} " )
25+ implementation(" io.infinitic:infinitic-client:${project.extra[" infiniticVersion" ]} " )
26+ implementation(" io.infinitic:infinitic-worker:${project.extra[" infiniticVersion" ]} " )
27+ implementation(" org.springframework.boot:spring-boot-starter" )
28+ implementation(" org.jetbrains.kotlin:kotlin-reflect" )
29+ annotationProcessor(" org.springframework.boot:spring-boot-configuration-processor" )
30+ testImplementation(" org.springframework.boot:spring-boot-starter-test" )
31+ }
32+
33+ tasks.withType<KotlinCompile > {
34+ kotlinOptions {
35+ freeCompilerArgs + = " -Xjsr305=strict"
36+ jvmTarget = " 17"
37+ }
38+ }
39+
40+ tasks.withType<Test > {
41+ useJUnitPlatform()
42+ }
Original file line number Diff line number Diff line change 1+ package com.tiarebalbi.example
2+
3+ import com.tiarebalbi.example.demo.DemoService
4+ import org.springframework.beans.factory.InitializingBean
5+ import org.springframework.boot.autoconfigure.SpringBootApplication
6+ import org.springframework.boot.runApplication
7+ import org.springframework.context.annotation.Bean
8+ import org.springframework.context.annotation.Configuration
9+
10+ @SpringBootApplication
11+ class InfiniticSpringBoot3ExampleApplication
12+
13+ fun main (args : Array <String >) {
14+ runApplication<InfiniticSpringBoot3ExampleApplication >(* args)
15+ }
16+
17+ @Configuration
18+ class Config {
19+
20+ @Bean
21+ fun initService (demoService : DemoService ) = InitializingBean {
22+ demoService.runDemoFlow()
23+ }
24+ }
Original file line number Diff line number Diff line change 1+ package com.tiarebalbi.example.demo
2+
3+ import io.infinitic.annotations.Name
4+
5+ @Name(" annotatedService" )
6+ interface AnnotatedService {
7+ @Name(" bar" )
8+ fun foo (str1 : String , str2 : String ): String
9+ }
10+
11+ @Suppress(" unused" )
12+ class AnnotatedServiceImpl : AnnotatedService {
13+ override fun foo (str1 : String , str2 : String ) = str1 + str2
14+ }
Original file line number Diff line number Diff line change 1+ package com.tiarebalbi.example.demo
2+
3+ import io.infinitic.annotations.Name
4+ import io.infinitic.workflows.Workflow
5+
6+ @Name(" annotatedWorkflow" )
7+ interface AnnotatedWorkflow {
8+ @Name(" bar" )
9+ fun concatABC (input : String ): String
10+ }
11+
12+ @Suppress(" unused" )
13+ class AnnotatedWorkflowImpl : Workflow (), AnnotatedWorkflow {
14+ private val service = newService(AnnotatedService ::class .java)
15+
16+ override fun concatABC (input : String ): String {
17+ var str = input
18+
19+ str = service.foo(str, " a" )
20+ str = service.foo(str, " b" )
21+ str = service.foo(str, " c" )
22+
23+ return str // should be "${input}abc"
24+ }
25+ }
Original file line number Diff line number Diff line change 1+ package com.tiarebalbi.example.demo
2+
3+ import io.infinitic.clients.InfiniticClient
4+ import org.springframework.stereotype.Service
5+
6+ @Service
7+ class DemoService (private val infiniticClient : InfiniticClient ) {
8+ fun runDemoFlow () {
9+ val event = this .infiniticClient.newWorkflow(AnnotatedWorkflow ::class .java)
10+ val result = event.concatABC(" Demo-" )
11+ println (" Result: $result " )
12+ }
13+ }
Original file line number Diff line number Diff line change 1+ # Enable auto-configure
2+ infinitic.enabled =true
3+
4+ # # Worker Setting
5+ infinitic.worker.enabled =true
6+ infinitic.worker.configuration =classpath:infinitic-worker.yml
7+
8+ # # Client Setting
9+ infinitic.client.enabled =true
10+ infinitic.client.configuration =classpath:infinitic-client.yml
Original file line number Diff line number Diff line change 1+ # Comment the line below to perform tests on a local Pulsar cluster
2+ transport : inMemory
3+
4+ pulsar :
5+ tenant : infinitic
6+ namespace : dev
Original file line number Diff line number Diff line change 1+ # Comment the line below to perform tests on a local Pulsar cluster
2+ transport : inMemory
3+
4+ pulsar :
5+ tenant : infinitic
6+ namespace : dev
7+
8+ services :
9+ - name : annotatedService
10+ class : com.tiarebalbi.example.demo.AnnotatedServiceImpl
11+ concurrency : 5
12+
13+ workflows :
14+ - name : annotatedWorkflow
15+ class : com.tiarebalbi.example.demo.AnnotatedWorkflowImpl
16+ concurrency : 5
Original file line number Diff line number Diff line change @@ -3,8 +3,9 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
33
44
55plugins {
6+ id(" org.springframework.boot" ) version " 3.1.4"
67 id(" com.github.ben-manes.versions" ) version " 0.48.0"
7- id( " org.springframework.boot " ) version " 3.1.3 "
8+
89 id(" io.spring.dependency-management" ) version " 1.1.3"
910 id(" org.jlleitschuh.gradle.ktlint" ) version " 11.5.1"
1011 id(" org.jetbrains.dokka" ) version " 1.9.0"
@@ -16,7 +17,7 @@ plugins {
1617}
1718
1819group = " com.tiarebalbi.infinitic"
19- version = " 1.0.0 "
20+ version = " 1.0.1 "
2021extra[" infiniticVersion" ] = " 0.11.6"
2122
2223val bootJar: org.springframework.boot.gradle.tasks.bundling.BootJar by tasks
@@ -50,6 +51,12 @@ repositories {
5051 mavenCentral()
5152}
5253
54+ configurations {
55+ compileOnly {
56+ extendsFrom(configurations.annotationProcessor.get())
57+ }
58+ }
59+
5360dependencies {
5461 implementation(" io.infinitic:infinitic-client:${project.extra[" infiniticVersion" ]} " )
5562 implementation(" io.infinitic:infinitic-worker:${project.extra[" infiniticVersion" ]} " )
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import io.infinitic.workers.InfiniticWorker
66import io.infinitic.workers.config.WorkerConfig
77import org.slf4j.LoggerFactory
88import org.springframework.beans.factory.InitializingBean
9+ import org.springframework.boot.autoconfigure.AutoConfiguration
910import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
1011import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
1112import org.springframework.boot.context.properties.EnableConfigurationProperties
@@ -45,6 +46,7 @@ import org.springframework.core.io.ResourceLoader
4546 * @param resourceLoader the ResourceLoader object used to load the client configuration file
4647 * @author tiare.balbi
4748 */
49+ @AutoConfiguration
4850@Configuration
4951@ConditionalOnProperty(
5052 name = [" infinitic.enabled" ],
You can’t perform that action at this time.
0 commit comments