Creating a HTTP2 server
- Create the Restate Server
- Bind one or multiple services to it.
- Listen on the specified port for connections and requests.
Customizing the HTTP2 server
Customizing the HTTP2 server
If you need to customize the HTTP2 server, or serve over HTTP1.1
you can call By default, this handler will advertise itself as working
bidirectionally; the SDK will try to get completions from the runtime
during execution.However, you can use the method
.Handler() instead of Start(), and then use the
handler as normal. To discover services over HTTP1.1 you must
provide the --use-http1.1 CLI flag..Bidirectional(false) on the endpoint
builder to change this on platforms that do not support bidirectional
communication, such as Lambda. If you don’t do this your handler may get
stuck.Connecting to Restate Cloud or BYOC
You can connect your service to Restate Cloud or BYOC through an outbound tunnel without exposing an inbound HTTP endpoint. Your service and handler implementations stay the same. Install the tunnel package:
On Kubernetes, the Restate operator supplies the environment ID, region, tunnel name, and signing public key when you use
tunnelMode: in-process. Follow the Kubernetes deployment guide to mount the API key and configure the deployment.
Outside Kubernetes, you can set these variables yourself, or pass the configuration explicitly as shown in the Containers and VMs guide. That guide also covers creating credentials and registering the tunnel deployment.
Creating a Lambda handler
To register your service as a Lambda function change the endpoint into a Lambda handler with.LambdaHandler(), and pass this handler to lambda.Start.