Skip to content

Commit

Permalink
Merge branch 'release/0.0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
zambrovski committed Aug 15, 2024
2 parents e2d2459 + 6366f7e commit 65dfb73
Show file tree
Hide file tree
Showing 64 changed files with 256 additions and 228 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,14 @@ The Correlation API provides functionality to correlate messages and signals wit
It is intended to be used in outbound adapters of the port/adapter architecture in order to control the process engine from your application.


### Task API
### User Task Completion API

The Task API provides functionality to deal with tasks. The task handlers can be registered and get invoked when tasks
The Task API provides functionality to deal with user tasks. Since the Task API allows asynchronous processing,
we provide a special API to complete user tasks.

### Service Task Completion API

The Task API provides functionality to deal with service tasks. The task handlers can be registered and get invoked when tasks
appear in the process engine. Since the Task API allows asynchronous processing, we provide a special API to complete tasks.

## Usage
Expand Down
2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>dev.bpm-crafters.process-engine-api</groupId>
<artifactId>process-engine-api-root</artifactId>
<version>0.0.3</version>
<version>0.0.4</version>
</parent>

<artifactId>process-engine-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import java.util.concurrent.Future
* API for completion of service tasks.
* @since 0.0.1
*/
interface ExternalTaskCompletionApi {
interface ServiceTaskCompletionApi {
/**
* Complete the task.
* @param cmd command to complete the task.
Expand All @@ -23,7 +23,7 @@ interface ExternalTaskCompletionApi {
fun completeTaskByError(cmd: CompleteTaskByErrorCmd): Future<Empty>

/**
* Failes to complete the task because of a technical failure.
* Fails to complete the task because of a technical failure.
* @param cmd command to indicate failure.
* @return future indicating the failure.
*/
Expand Down
2 changes: 1 addition & 1 deletion bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>dev.bpm-crafters.process-engine-api</groupId>
<artifactId>process-engine-api-root</artifactId>
<version>0.0.3</version>
<version>0.0.4</version>
</parent>

<artifactId>process-engine-api-bom</artifactId>
Expand Down
10 changes: 5 additions & 5 deletions docs/getting-started/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ dev:
adapter:
c7embedded:
enabled: true
external-service-tasks:
service-tasks:
delivery-strategy: embedded_job
worker-id: embedded-worker
lock-time-in-seconds: 10
Expand Down Expand Up @@ -124,13 +124,13 @@ dev:
adapter:
c7remote:
enabled: true
external-service-tasks:
service-tasks:
delivery-strategy: remote_scheduled
fixed-rate-schedule-rate: 10
schedule-delivery-fixed-rate-in-seconds: 10
worker-id: embedded-worker
lock-time-in-seconds: 10
user-tasks:
fixed-rate-schedule-rate: 10
schedule-delivery-fixed-rate-in-seconds: 10
delivery-strategy: remote_scheduled

# to tell the client library where the engine is located provide the correct details below:
Expand Down Expand Up @@ -182,7 +182,7 @@ dev:
worker-id: worker
user-tasks:
delivery-strategy: subscription_refreshing
fixed-rate-schedule-rate: 5000 # every 5 seconds
schedule-delivery-fixed-rate-in-seconds: 5000 # every 5 seconds
tasklist-url: https://${zeebe.client.cloud.region}.tasklist.camunda.io/${zeebe.client.cloud.clusterId}
fixed-rate-refresh-rate: 5000 # every 5 seconds

Expand Down
2 changes: 1 addition & 1 deletion engine-adapter/adapter-commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>dev.bpm-crafters.process-engine-api</groupId>
<artifactId>process-engine-api-root</artifactId>
<version>0.0.3</version>
<version>0.0.4</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion engine-adapter/adapter-testing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>dev.bpm-crafters.process-engine-api</groupId>
<artifactId>process-engine-api-root</artifactId>
<version>0.0.3</version>
<version>0.0.4</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import com.tngtech.jgiven.annotation.ProvidedScenarioState
import dev.bpmcrafters.processengineapi.process.StartProcessByDefinitionCmd
import dev.bpmcrafters.processengineapi.process.StartProcessByMessageCmd
import dev.bpmcrafters.processengineapi.task.*
import io.mockk.mockk
import io.toolisticon.testing.jgiven.JGivenKotlinStage
import io.toolisticon.testing.jgiven.step
import mu.KLogging
Expand Down Expand Up @@ -99,7 +98,7 @@ class BaseGivenWhenStage : Stage<BaseGivenWhenStage>() {
fun `complete the external task`() = step {
assertThat(externalTaskId).isNotEmpty()

processTestHelper.getExternalTaskCompletionApi().completeTask(
processTestHelper.getServiceTaskCompletionApi().completeTask(
CompleteTaskCmd(
taskId = externalTaskId!!,
payloadSupplier = { emptyMap() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package dev.bpmcrafters.processengineapi.test

import dev.bpmcrafters.processengineapi.process.ProcessInformation
import dev.bpmcrafters.processengineapi.process.StartProcessApi
import dev.bpmcrafters.processengineapi.task.ExternalTaskCompletionApi
import dev.bpmcrafters.processengineapi.task.ServiceTaskCompletionApi
import dev.bpmcrafters.processengineapi.task.TaskSubscriptionApi
import dev.bpmcrafters.processengineapi.task.UserTaskCompletionApi

Expand All @@ -14,7 +14,7 @@ interface ProcessTestHelper {

fun getUserTaskCompletionApi(): UserTaskCompletionApi

fun getExternalTaskCompletionApi(): ExternalTaskCompletionApi
fun getServiceTaskCompletionApi(): ServiceTaskCompletionApi

fun triggerPullingUserTaskDeliveryManually()

Expand Down
2 changes: 1 addition & 1 deletion engine-adapter/camunda-platform-7-embedded-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>dev.bpm-crafters.process-engine-api</groupId>
<artifactId>process-engine-api-root</artifactId>
<version>0.0.3</version>
<version>0.0.4</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import dev.bpmcrafters.processengineapi.adapter.commons.task.SubscriptionReposit
import dev.bpmcrafters.processengineapi.task.CompleteTaskByErrorCmd
import dev.bpmcrafters.processengineapi.task.CompleteTaskCmd
import dev.bpmcrafters.processengineapi.task.FailTaskCmd
import dev.bpmcrafters.processengineapi.task.ExternalTaskCompletionApi
import dev.bpmcrafters.processengineapi.task.ServiceTaskCompletionApi
import mu.KLogging
import org.camunda.bpm.engine.ExternalTaskService
import java.util.concurrent.CompletableFuture
Expand All @@ -14,11 +14,11 @@ import java.util.concurrent.Future
/**
* Strategy for completing external tasks using Camunda externalTaskService Java API.
*/
class C7ExternalTaskCompletionApiImpl(
class C7ServiceTaskCompletionApiImpl(
private val workerId: String,
private val externalTaskService: ExternalTaskService,
private val subscriptionRepository: SubscriptionRepository
) : ExternalTaskCompletionApi {
) : ServiceTaskCompletionApi {

companion object : KLogging()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import org.camunda.bpm.engine.externaltask.LockedExternalTask
* Delivers external tasks to subscriptions.
* This implementation uses internal Java API and pulls tasks for delivery.
*/
class EmbeddedPullExternalTaskDelivery(
class EmbeddedPullServiceTaskDelivery(
private val externalTaskService: ExternalTaskService,
private val workerId: String,
private val subscriptionRepository: SubscriptionRepository,
Expand Down Expand Up @@ -76,6 +76,7 @@ class EmbeddedPullExternalTaskDelivery(
.distinct()
.forEach { topic ->
this.topic(topic, lockDuration)
.enableCustomObjectDeserialization()
}
return this
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package dev.bpmcrafters.processengineapi.adapter.c7.embedded.process

import dev.bpmcrafters.processengineapi.adapter.c7.embedded.task.completion.C7ExternalTaskCompletionApiImpl
import dev.bpmcrafters.processengineapi.adapter.c7.embedded.task.completion.C7ServiceTaskCompletionApiImpl
import dev.bpmcrafters.processengineapi.adapter.c7.embedded.task.completion.C7UserTaskCompletionApiImpl
import dev.bpmcrafters.processengineapi.adapter.c7.embedded.task.delivery.pull.EmbeddedPullExternalTaskDelivery
import dev.bpmcrafters.processengineapi.adapter.c7.embedded.task.delivery.pull.EmbeddedPullServiceTaskDelivery
import dev.bpmcrafters.processengineapi.adapter.c7.embedded.task.delivery.pull.EmbeddedPullUserTaskDelivery
import dev.bpmcrafters.processengineapi.adapter.c7.embedded.task.subscription.C7TaskSubscriptionApiImpl
import dev.bpmcrafters.processengineapi.adapter.commons.task.InMemSubscriptionRepository
import dev.bpmcrafters.processengineapi.process.ProcessInformation
import dev.bpmcrafters.processengineapi.process.StartProcessApi
import dev.bpmcrafters.processengineapi.task.ExternalTaskCompletionApi
import dev.bpmcrafters.processengineapi.task.ServiceTaskCompletionApi
import dev.bpmcrafters.processengineapi.task.TaskSubscriptionApi
import dev.bpmcrafters.processengineapi.task.UserTaskCompletionApi
import dev.bpmcrafters.processengineapi.test.ProcessTestHelper
Expand All @@ -25,7 +25,7 @@ class C7EmbeddedProcessTestHelper(private val processEngine: ProcessEngine) : Pr
subscriptionRepository = subscriptionRepository
)

private var embeddedPullExternalTaskDelivery: EmbeddedPullExternalTaskDelivery = EmbeddedPullExternalTaskDelivery(
private var embeddedPullExternalTaskDelivery: EmbeddedPullServiceTaskDelivery = EmbeddedPullServiceTaskDelivery(
externalTaskService = processEngine.externalTaskService,
workerId = WORKER_ID,
subscriptionRepository = subscriptionRepository,
Expand All @@ -47,7 +47,7 @@ class C7EmbeddedProcessTestHelper(private val processEngine: ProcessEngine) : Pr
subscriptionRepository = subscriptionRepository
)

override fun getExternalTaskCompletionApi(): ExternalTaskCompletionApi = C7ExternalTaskCompletionApiImpl(
override fun getServiceTaskCompletionApi(): ServiceTaskCompletionApi = C7ServiceTaskCompletionApiImpl(
workerId = WORKER_ID,
externalTaskService = processEngine.externalTaskService,
subscriptionRepository = subscriptionRepository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>dev.bpm-crafters.process-engine-api</groupId>
<artifactId>process-engine-api-root</artifactId>
<version>0.0.3</version>
<version>0.0.4</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import dev.bpmcrafters.processengineapi.adapter.c7.embedded.correlation.Correlat
import dev.bpmcrafters.processengineapi.adapter.c7.embedded.correlation.SignalApiImpl
import dev.bpmcrafters.processengineapi.adapter.c7.embedded.deploy.DeploymentApiImpl
import dev.bpmcrafters.processengineapi.adapter.c7.embedded.process.StartProcessApiImpl
import dev.bpmcrafters.processengineapi.adapter.c7.embedded.task.completion.C7ExternalTaskCompletionApiImpl
import dev.bpmcrafters.processengineapi.adapter.c7.embedded.task.completion.C7ServiceTaskCompletionApiImpl
import dev.bpmcrafters.processengineapi.adapter.c7.embedded.task.completion.C7UserTaskCompletionApiImpl
import dev.bpmcrafters.processengineapi.adapter.c7.embedded.task.subscription.C7TaskSubscriptionApiImpl
import dev.bpmcrafters.processengineapi.adapter.commons.task.InMemSubscriptionRepository
Expand All @@ -13,7 +13,7 @@ import dev.bpmcrafters.processengineapi.correlation.CorrelationApi
import dev.bpmcrafters.processengineapi.correlation.SignalApi
import dev.bpmcrafters.processengineapi.deploy.DeploymentApi
import dev.bpmcrafters.processengineapi.process.StartProcessApi
import dev.bpmcrafters.processengineapi.task.ExternalTaskCompletionApi
import dev.bpmcrafters.processengineapi.task.ServiceTaskCompletionApi
import dev.bpmcrafters.processengineapi.task.TaskSubscriptionApi
import dev.bpmcrafters.processengineapi.task.UserTaskCompletionApi
import org.camunda.bpm.engine.ExternalTaskService
Expand All @@ -25,7 +25,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Primary
import org.springframework.scheduling.annotation.EnableScheduling

@Configuration
Expand Down Expand Up @@ -69,13 +68,13 @@ class C7EmbeddedAdapterAutoConfiguration {

@Bean("c7embedded-service-task-completion-api")
@Qualifier("c7embedded-service-task-completion-api")
fun externalTaskCompletionApi(
fun serviceTaskCompletionApi(
externalTaskService: ExternalTaskService,
subscriptionRepository: SubscriptionRepository,
c7AdapterProperties: C7EmbeddedAdapterProperties
): ExternalTaskCompletionApi =
C7ExternalTaskCompletionApiImpl(
workerId = c7AdapterProperties.externalServiceTasks.workerId,
): ServiceTaskCompletionApi =
C7ServiceTaskCompletionApiImpl(
workerId = c7AdapterProperties.serviceTasks.workerId,
externalTaskService = externalTaskService,
subscriptionRepository = subscriptionRepository
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class C7EmbeddedAdapterProperties(
* Configuration for external service tasks.
*/
@NestedConfigurationProperty
val externalServiceTasks: ExternalServiceTasks,
val serviceTasks: ServiceTasks,

/**
* Configuration of user tasks.
Expand All @@ -38,7 +38,7 @@ class C7EmbeddedAdapterProperties(
/**
* Fixed rate for scheduled user task delivery.
*/
val fixedRateScheduleRate: Long = 5_000L,
val scheduleDeliveryFixedRateInSeconds: Long = 5_000L,
/**
* Should an initial pull be executed on startup.
*/
Expand All @@ -48,7 +48,7 @@ class C7EmbeddedAdapterProperties(
/**
* Configuration for external service task handling.
*/
data class ExternalServiceTasks(
data class ServiceTasks(
/**
* Default id of the worker used for the external task.
*/
Expand All @@ -68,7 +68,7 @@ class C7EmbeddedAdapterProperties(
/**
* Fixed rate for scheduled user task delivery.
*/
val fixedRateScheduleRate: Long = 13_000L,
val scheduleDeliveryFixedRateInSeconds: Long = 13_000L,
/**
* Delivery strategy for external service tasks.
*/
Expand Down
Loading

0 comments on commit 65dfb73

Please sign in to comment.