Git Product home page Git Product logo

my-first-ksw's Introduction

Getting Started with Kogito Serverless Workflow

This guide quickly explains how to getting started with Kogito Serverless Workflows in your local machine

Prereqs

  1. Java SDK installed
  2. Maven installed
  3. Quarkus CLI

To edit your workflows:

  1. Visual Studio Code with Red Hat Java Plugin installed
  2. Serverless Workflow Editor

Creating the project

To create the project skeleton, run:

quarkus create app -x=kogito-quarkus-serverless-workflow,quarkus-container-image-jib,quarkus-resteasy-jackson,quarkus-smallrye-openapi  org.acme:my-first-ksw:1.0

The org.acme:my-first-ksw:1.0 is the group id, artifact id, and version of your project.

This command will create a Maven Quarkus project in the my-first-ksw directory with all required Kogito dependencies.

Next, to make sure everything is working fine, try to compile the project with:

quarkus build

Creating your first Workflow

Go to the directory src/main/resources and take a look at greetings.sw.yaml. You can play around and type the workflow definition by hand using the editor intellisense feature or using the text editor of your choice Then run quarkus dev from the project's root to start the Quarkus console.

To interact with the application, we have a couple of options described in the sections below.

Using the Swagger UI

Point your browser to the http://localhost:8080/q/swagger-ui/ address. You should see a POST endpoint definition for this workflow named Greetings. Click on the POST entry and in the button "Try it".

Copy and paste the following content:

{
  "workflowdata": {
   "name" : "John",
   "language": "English"
  }
}

Click on "Execute" and you should see a response similarly to this one:

{
  "id": "c758eb9d-6242-4bda-a5f5-7f5d302943c0",
  "workflowdata": {
    "name": "John",
    "language": "English",
    "greeting": "Hello from YAML Workflow, ",
    "finalGreeting": "Hello from YAML Workflow,  John"
  }
}

Calling the service via command line

You can use an one line curl:

curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{"workflowdata" : {"name": "John", "language": "English"}}' http://localhost:8080/greetings

Building your project's image

You can use the Quarkus CLI to build your image with the following command:

quarkus build -Dquarkus.container-image.build=true

After building the image, you can start the container running:

docker run --rm -it -p8080:8080 <username>/my-first-ksw:1.0

You can then interact with the application the same way you did before in the previous sections.

Resources

my-first-ksw's People

Contributors

fjtirado avatar ricardozanini avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.