Skip to main content

Registration

After deploying an endpoint, you need to register it with Restate. That way Restate knows where it runs and can invoke it.

Registering deployments

Register a service endpoint URI as follows:


restate deployments register localhost:9080

Output

❯ SERVICES THAT WILL BE ADDED:
- CheckoutService
Type: Service
HANDLER INPUT TYPE OUTPUT TYPE
handle one of "empty or value of content-type */*" value with content-type "application/json"
- CartObject
Type: VirtualObject ⬅️ 🚶🚶🚶
HANDLER INPUT TYPE OUTPUT TYPE
addTicket one of "empty or value of content-type */*" value with content-type "application/json"
expireTicket one of "empty or value of content-type */*" value with content-type "application/json"
checkout one of "empty or value of content-type */*" value with content-type "application/json"
- TicketObject
Type: VirtualObject ⬅️ 🚶🚶🚶
HANDLER INPUT TYPE OUTPUT TYPE
reserve one of "empty or value of content-type */*" value with content-type "application/json"
markAsSold one of "empty or value of content-type */*" value with content-type "application/json"
unreserve one of "empty or value of content-type */*" value with content-type "application/json"
✔ Are you sure you want to apply those changes? · yes
✅ DEPLOYMENT:
SERVICE REV
TicketObject 1
CheckoutService 1
CartObject 1

Or you can use the shorthand restate dp add.

Running locally Restate with Docker

When running Restate in a Docker, replace localhost with host.docker.internal.

Updating services

A service can be registered only once. Subsequent registration requests to the same deployment will fail. For more details on how to update services, check the versioning docs.

When developing locally, you can forcefully overwrite an existing deployment:


restate dp add --force localhost:9080

This will forcefully overwrite the existing service deployment with the same URI, forcing the discovery process again. It will also remove services that were served by that deployment and are not available anymore.

warning

Forcing a deployment registration is a feature designed to simplify local Restate service development, and should never be used in a production Restate deployment, as it potentially breaks all the in-flight invocations to that deployment.

Private services

When registering an endpoint, every service is by default reachable via HTTP requests.

You can configure a service as private, such that you can't invoke it over HTTP, through the Admin API (docs):


curl -X PATCH localhost:9070/services/MyService \
-H 'content-type: application/json' \
-d '{"public": false}'

You can revert it back to public with {"public": true}.

info

Private services can still be invoked by other handlers via the SDK.