Job Service Quarkus Extensions
The interaction between the workflows and the Job Service is handled by the different Job Service Quarkus Extensions. Each extension is designed to work with a different communication alternative.
For example, you can select if your workflows must interact with the Job Service by sending cloud events over the knative eventing system or the kafka messaging system, or simply by executing direct REST calls.
Finally, for the interaction work, you must configure your Quarkus Workflow Project with the extension of your choice.
We recommend that you follow this procedure:
-
Identify the communication alternative that best fits your scenario.
-
Be sure that the Job Service is properly configured to support that alternative. This is very important if you want to use knative events or kafka messages to communicate with it.
-
Configure your Quarkus Workflow Project with the corresponding extension.
If your workflows are not using timer-based actions, like timeouts, there is no need to add such an extension. |
Knative eventing interaction
To interact with the Job Service by sending cloud events over the knative eventing system you must follow these steps:
-
Be sure that you have read the Consuming and producing events on Knative Eventing guide, and that you have configured the project accordingly.
-
Add the
kogito-addons-quarkus-jobs-knative-eventing
extension to your Quarkus Workflow Project using any of the following alternatives:
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>kogito-addons-quarkus-jobs-knative-eventing</artifactId>
</dependency>
mvn quarkus:add-extension -Dextensions="kogito-addons-quarkus-jobs-knative-eventing"
quarkus extension add kogito-addons-quarkus-jobs-knative-eventing
-
Add the following configurations to the
application.properties
file of your project.
mp.messaging.outgoing.kogito-job-service-job-request-events.connector=quarkus-http
mp.messaging.outgoing.kogito-job-service-job-request-events.url=${K_SINK:http://localhost:8280/v2/jobs/events}
mp.messaging.outgoing.kogito-job-service-job-request-events.method=POST
The If this variable is not present, the default value |
-
Build your project and locate the automatically generated
kogito.yml
andknative.yml
files in the/target/kubernetes
directory of your project, see.
mvn clean install
-
Use the generated files to deploy your workflow application in the Kubernetes cluster using the following commands:
kubectl apply -f target/kogito.yml
kubectl apply -f target/knative.yml
You can see a full example of this interaction mode configuration in the Quarkus Workflow Project with standalone services example project.
Kafka messaging interaction
To interact with the Job Service by sending cloud events over the kafka messaging system you must follow these steps:
-
Be sure that you have read the Consuming and producing events with Kafka guide, and you have configured the project accordingly.
-
Add the
quarkus-smallrye-reactive-messaging-kafka
andkogito-addons-quarkus-jobs-messaging
extensions to your Quarkus Workflow Project using any of the following alternatives.
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-reactive-messaging-kafka</artifactId>
</dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>kogito-addons-quarkus-jobs-messaging</artifactId>
</dependency>
mvn quarkus:add-extension -Dextensions="quarkus-smallrye-reactive-messaging-kafka,kogito-addons-quarkus-jobs-messaging"
quarkus extension add quarkus-smallrye-reactive-messaging-kafka kogito-addons-quarkus-jobs-messaging
-
Add the following configurations to the
application.properties
file of your project.
mp.messaging.outgoing.kogito-job-service-job-request-events.connector=smallrye-kafka
mp.messaging.outgoing.kogito-job-service-job-request-events.topic=kogito-job-service-job-request-events-v2
mp.messaging.outgoing.kogito-job-service-job-request-events.value.serializer=org.apache.kafka.common.serialization.StringSerializer
-
Build and deploy your workflow application using any of the available procedures.
REST call interaction
To interact with the Job Service by executing direct REST calls you must follow these steps:
-
Add the
kogito-addons-quarkus-jobs-management
extension to your Quarkus Workflow Project using any of the following alternatives.
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>kogito-addons-quarkus-jobs-management</artifactId>
</dependency>
mvn quarkus:add-extension -Dextensions="kogito-addons-quarkus-jobs-management"
quarkus extension add kogito-addons-quarkus-jobs-management
-
Add the following configuration to the
application.properties
file of your project.
kogito.jobs-service.url=http://localhost:8280
When you deploy your project in a Kubernetes cluster, you must configure the |
-
Build and deploy your workflow application using any of the available procedures.
Job Service Embedded
To facilitate the development and testing stage of your workflows, this extension provides an embedded Job Service instance that executes in the same runtime as your workflows, and thus, requires no additional configurations. The only consideration is that it must not be used for production installations.
To use this extension you must:
-
Add the
kogito-addons-quarkus-jobs-service-embedded
extension to your Quarkus Workflow Project using any of the following alternatives.
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>kogito-addons-quarkus-jobs-service-embedded</artifactId>
</dependency>
mvn quarkus:add-extension -Dextensions="kogito-addons-quarkus-jobs-management"
quarkus extension add kogito-addons-quarkus-jobs-management
-
Build and deploy your workflow application using any of the available procedures.
You can see a full example of Job Service embedded usage in the Quarkus Workflow Project with embedded services example project.
Found an issue?
If you find an issue or any misleading information, please feel free to report it here. We really appreciate it!