From d7b3555ff42d9af4d420a7915bf42e6386d130ec Mon Sep 17 00:00:00 2001 From: Taeik Lim Date: Mon, 15 Apr 2024 00:16:48 +0900 Subject: [PATCH] Add docs for BatchJobObservationConvention, BatchStepObservationConvention Signed-off-by: Taeik Lim --- .../kotlin-dsl/job/job-configuration.md | 24 +++++++++++++++++ .../kotlin-dsl/step/step-configuration.md | 24 +++++++++++++++++ .../kotlin-dsl/job/job-configuration.md | 25 ++++++++++++++++++ .../kotlin-dsl/step/step-configuration.md | 26 ++++++++++++++++++- 4 files changed, 98 insertions(+), 1 deletion(-) diff --git a/doc/en/configuration/kotlin-dsl/job/job-configuration.md b/doc/en/configuration/kotlin-dsl/job/job-configuration.md index 53330a3e..db887046 100644 --- a/doc/en/configuration/kotlin-dsl/job/job-configuration.md +++ b/doc/en/configuration/kotlin-dsl/job/job-configuration.md @@ -5,6 +5,7 @@ - [Set a listener using annotations](#set-a-listener-using-annotations) - [Set a listener using a JobExecutionListener object](#set-a-listener-using-a-jobexecutionlistener-object) - [Set a MeterRegistry](#set-a-meterregistry) +- [Set a BatchJobObservationConvention](#set-a-batchjobobservationconvention) - [Set a ObservationRegistry](#set-a-observationregistry) - [Set preventRestart](#set-preventrestart) - [Set a Repository](#set-a-repository) @@ -165,6 +166,29 @@ open class TestJobConfig( } ``` +## Set a BatchJobObservationConvention + +The Kotlin DSL helps you set a `BatchJobObservationConvention` using `JobBuilder`. + +```kotlin +@Configuration +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { + + @Bean + open fun testJob(): Job = batch { + job("testJob") { + observationConvention(DefaultBatchJobObservationConvention()) + step("testStep") { + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) + } + } + } +} +``` + ## Set a ObservationRegistry The Kotlin DSL helps you set a `ObservationRegistry` using `JobBuilder`. diff --git a/doc/en/configuration/kotlin-dsl/step/step-configuration.md b/doc/en/configuration/kotlin-dsl/step/step-configuration.md index ba4f8fbe..5ef9fabe 100644 --- a/doc/en/configuration/kotlin-dsl/step/step-configuration.md +++ b/doc/en/configuration/kotlin-dsl/step/step-configuration.md @@ -1,6 +1,7 @@ # Step Configuration - [Set a job repository](#set-a-job-repository) +- [Set a BatchStepObservationConvention](#set-a-batchstepobservationconvention) - [Set a ObservationRegistry](#set-a-observationregistry) - [Set a MeterRegistry](#set-a-meterregistry) - [Set startLimit](#set-startlimit) @@ -42,6 +43,29 @@ open class TestJobConfig( } ``` +## Set a BatchStepObservationConvention + +The Kotlin DSL helps you set a `BatchStepObservationConvention` using `StepBuilder`. + +```kotlin +@Configuration +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { + + @Bean + open fun testJob(): Job = batch { + job("testJob") { + step("testStep") { + observationConvention(DefaultBatchStepObservationConvention()) + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) + } + } + } +} +``` + ## Set a ObservationRegistry The Kotlin DSL helps you set a `ObservationRegistry` using `StepBuilder`. diff --git a/doc/ko/configuration/kotlin-dsl/job/job-configuration.md b/doc/ko/configuration/kotlin-dsl/job/job-configuration.md index 85a1af1d..37ab524f 100644 --- a/doc/ko/configuration/kotlin-dsl/job/job-configuration.md +++ b/doc/ko/configuration/kotlin-dsl/job/job-configuration.md @@ -5,6 +5,7 @@ - [Annotation을 사용해서 Listener 설정하기](#annotation을-사용해서-listener-설정하기) - [JobExecutionListener 객체를 사용하여 Listener 설정하기](#jobexecutionlistener-객체를-사용하여-listener-설정하기) - [MeterRegistry 설정하기](#meterregistry-설정하기) +- [BatchJobObservationConvention 설정하기](#batchjobobservationconvention-설정하기) - [ObservationRegistry 설정하기](#observationregistry-설정하기) - [PreventRestart 설정하기](#preventrestart-설정하기) - [Repository 설정하기](#repository-설정하기) @@ -165,6 +166,30 @@ open class TestJobConfig( } ``` + +## BatchJobObservationConvention 설정하기 + +Kotlin DSL은 `JobBuilder`를 사용해서 `BatchJobObservationConvention` 설정을 하는 방법을 제공합니다. + +```kotlin +@Configuration +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { + + @Bean + open fun testJob(): Job = batch { + job("testJob") { + observationConvention(DefaultBatchJobObservationConvention()) + step("testStep") { + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) + } + } + } +} +``` + ## ObservationRegistry 설정하기 Kotlin DSL은 `JobBuilder`를 사용해서 `ObservationRegistry` 설정을 하는 방법을 제공합니다. diff --git a/doc/ko/configuration/kotlin-dsl/step/step-configuration.md b/doc/ko/configuration/kotlin-dsl/step/step-configuration.md index 774fbb3e..935a27aa 100644 --- a/doc/ko/configuration/kotlin-dsl/step/step-configuration.md +++ b/doc/ko/configuration/kotlin-dsl/step/step-configuration.md @@ -1,6 +1,7 @@ # Step Configuration - [Job Repository 설정](#job-repository-설정) +- [BatchStepObservationConvention 설정](#batchstepobservationconvention-설정) - [ObservationRegistry 설정](#observationregistry-설정) - [MeterRegistry 설정](#meterregistry-설정) - [StartLimit 설정](#startlimit-설정) @@ -42,6 +43,29 @@ open class TestJobConfig( } ``` +## BatchStepObservationConvention 설정 + +Kotlin DSL은 `StepBuilder`를 사용하여 `BatchStepObservationConvention`을 설정하는 방법을 제공합니다. + +```kotlin +@Configuration +open class TestJobConfig( + private val batch: BatchDsl, + private val transactionManager: PlatformTransactionManager, +) { + + @Bean + open fun testJob(): Job = batch { + job("testJob") { + observationConvention(DefaultBatchJobObservationConvention()) + step("testStep") { + tasklet({ _, _ -> RepeatStatus.FINISHED }, transactionManager) + } + } + } +} +``` + ## ObservationRegistry 설정 Kotlin DSL은 `StepBuilder`를 사용하여 `ObservationRegistry`을 설정하는 방법을 제공합니다. @@ -229,4 +253,4 @@ open class TestJobConfig( } } } -``` \ No newline at end of file +```