Unmeshed Logo

Language SDKs

Unmeshed Java SDK

This README will guide you on how to set up Unmeshed credentials, run workers, and get started with the Unmeshed platform using the Java SDK.


Prerequisites

Before running your Java project, make sure you have:

  1. Java Development Kit (JDK): Java 21 or above.
  2. Maven or Gradle: For managing dependencies.
  3. Unmeshed SDK dependency: See your build.gradle or pom.xml.
  4. Environment Variables:
    • UNMESHED_AUTH_ID: Your Unmeshed authentication ID.
    • UNMESHED_AUTH_TOKEN: Your Unmeshed authentication token.
    • UNMESHED_ENGINE_HOST: Base URL for the Unmeshed server (defaults to http://localhost).
    • UNMESHED_ENGINE_PORT: Port (defaults to 8080).

For help generating your Auth ID and Auth Token, see the Creating Client Credentials.


Setup Instructions

  1. Clone the Repository:
bash
  1. Run Main.java to start the example application.

Writing Your Own Worker

  1. Check example workers in io.unmeshed.sdk.samples.workers:

    • ArithmeticWorker
    • HelloWorldWorker
  2. Create a new worker class, or add a new method in an existing worker class.

  3. Annotate the method with @WorkerFunction(name = "<worker_name>"), where <worker_name> is the worker queue name you want to bind to.

Example:

java

Register Inline (Lambda) Workers

You can register lambda workers directly with the client:

java

Accessing Execution Context

To get additional context such as step ID or process ID inside your worker:

java

See HelloWorldWorker.java for a concrete example.


Process Management

The SDK provides comprehensive process definition management capabilities. See ProcessManagementExamples.java for a complete working example.

Create a Process Definition

java

Create a Step Definition

java

Get Process Definition (Latest or Specific Version)

java

Get All Process Definitions

java

Update a Process Definition

java

Delete Process Definitions

java

Complete Process Management Example

ProcessManagementExamples.java demonstrates:

  • Creating a process definition with steps
  • Fetching the latest version of a process
  • Retrieving all process definitions
  • Updating an existing process definition
  • Deleting process definitions

Visit Unmeshed to get started.