An invocation is a request to execute a handler. You can invoke handlers over HTTP with or without waiting for a response, and with or without an idempotency key. Make sure to first register the handler you want to invoke. The UI helps you with invoking your services. Open the UI at port 9070, register your service, click on the service, open the playground, and invoke your handlers from there.Documentation Index
Fetch the complete documentation index at: https://restate-6d46e1dc-mintlify-java-sdk-v2-7-0-1778569850.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Each invocation has its own unique ID and lifecycle.
Have a look at managing invocations to learn how to manage the lifecycle of an invocation.
Request-response calls
You can invoke services over HTTP 1.1 or higher. Request/response bodies should be encoded as JSON. InvokingmyHandler of myService as follows:
myHandler of myVirtualObject for myObjectKey as follows:
run handler of the MyWorkflow as follows:
x-restate-id.
Follow the same pattern for calling the other handlers of the workflow.
Note that all invocations go first via the Restate Server. The server then forwards the request to the appropriate service.
Therefore,
localhost:8080 refers to ingress port of the Restate Server, not the service instance.Sending messages
If you do not want to wait for the response, you can also send a message by adding/send to the URL path:
Delayed messages
You can delay the message by adding a delay request parameter in ISO8601 notation or using humantime format:You cannot yet use this feature for workflows.
Workflows can only be scheduled with a delay from within another Restate handler (TS/Java/Kotlin).
Using an idempotency key
You can send requests to Restate providing an idempotency key, through theIdempotency-Key header:
Cancel
You can cancel an invocation as follows:curl
Attach to an invocation
Restate allows you to retrieve the result of workflows and invocations with an idempotency key. There are two options:- To attach to an invocation or workflow and wait for it to finish, use
/attach. - To peek at the output of an invocation or workflow, use
/output. This will return:{"message":"not ready"}for ongoing workflows- The result for finished workflows
{"message":"not found"}for non-existing workflows
OpenAPI support
Restate exposes for every service an OpenAPI 3.1 definition, to get it:- TypeScript SDK with Zod schemas
- Python SDK with Pydantic models
- Java and Kotlin SDK