Skip to content

Latest commit

 

History

History
 
 

process-service-calls-springboot

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Process Service invocation

Description

A quickstart project that processes travellers in the system. It's main purpose is to illustrate local service invocation.

This example shows

  • invoking local service class that is a injectable bean

  • control flow based on service calls

  • New Travelers Diagram

  • New Travelers Diagram Properties

  • New Travelers Diagram Properties

  • Store Traveler Service Call

  • Store Traveler Service Call

  • Store Traveler Service Call

  • Stored Traveler Gateway Yes Connector

  • Stored Traveler Gateway No Connector

  • Greet New Traveler Service Call

  • Greet New Traveler Service Call

  • Audit Traveler Service Call

  • Audit Traveler Service Call

  • Multi Params Process

  • Multi Params Diagram Properties

  • Multi Params Diagram Properties

  • Hello Service Calls

  • Hello Service Calls

Build and run

Prerequisites

You will need:

  • Java 11+ installed
  • Environment variable JAVA_HOME set accordingly
  • Maven 3.8.6+ installed

Compile and Run in Local Dev Mode

mvn clean compile spring-boot:run

Compile and Run using uberjar

mvn clean package

To run the generated native executable, generated in target/, execute

java -jar target/process-service-calls-springboot.jar

OpenAPI (Swagger) documentation

Specification at swagger.io

You can take a look at the OpenAPI definition - automatically generated and included in this service - to determine all available operations exposed by this service. For easy readability you can visualize the OpenAPI definition file using a UI tool like for example available Swagger UI.

In addition, various clients to interact with this service can be easily generated using this OpenAPI definition.

Submit a traveller

To make use of this application it is as simple as putting a sending request to http://localhost:8080/travellers with following content

{
"traveller" : {
  "firstName" : "John",
  "lastName" : "Doe",
  "email" : "[email protected]",
  "nationality" : "American",
  "address" : {
  	"street" : "main street",
  	"city" : "Boston",
  	"zipCode" : "10005",
  	"country" : "US" }
  }
}

Complete curl command can be found below:

curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{"traveller" : { "firstName" : "John", "lastName" : "Doe", "email" : "[email protected]", "nationality" : "American","address" : { "street" : "main street", "city" : "Boston", "zipCode" : "10005", "country" : "US" }}}' http://localhost:8080/travellers

After the above command you should see a log similar to the following

Calling a Simple Hello Service

To call Hello Service send a request to http://localhost:8080/multiparams with following content

{
  "name" : "John",
  "age" : 44,
}

Complete curl command can be found below:

curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{"name" : "John", "age" : 44}' http://localhost:8080/multiparams

After the above command you should see a log similar to the following

Deploying with Kogito Operator

In the operator directory you'll find the custom resources needed to deploy this example on OpenShift with the Kogito Operator.