Package dev.restate.sdk.endpoint
Class Endpoint.Builder
java.lang.Object
dev.restate.sdk.endpoint.Endpoint.Builder
- Enclosing class:
Endpoint
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbind
(ServiceDefinition serviceDefinition) Add a manualServiceDefinition
to the endpoint.Add a Restate service to the endpoint.bind
(Object service, HandlerRunner.Options options) Likebind(Object)
, but allows to provide options for the handler runner.bind
(Object service, HandlerRunner.Options options, Consumer<ServiceDefinition.Configurator> configurator) Same asbind(Object, HandlerRunner.Options)
but allows to configure theServiceDefinition
before binding it.bind
(Object service, Consumer<ServiceDefinition.Configurator> configurator) Same asbind(Object)
but allows to configure theServiceDefinition
before binding it.build()
io.opentelemetry.api.OpenTelemetry
void
setOpenTelemetry
(io.opentelemetry.api.OpenTelemetry openTelemetry) Same aswithOpenTelemetry(OpenTelemetry)
.void
setRequestIdentityVerifier
(RequestIdentityVerifier requestIdentityVerifier) withOpenTelemetry
(io.opentelemetry.api.OpenTelemetry openTelemetry) Set theOpenTelemetry
implementation for tracing and metrics.withRequestIdentityVerifier
(RequestIdentityVerifier requestIdentityVerifier) Set the request identity verifier for this endpoint.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
bind
Add a Restate service to the endpoint. This will automatically discover the generated factory based on the class name.If you want to modify some of the service definition options, such as documentation, inactivity timeout, and so on, use
bind(Object, Consumer)
instead.You can also manually instantiate the
ServiceDefinition
usingbind(ServiceDefinition)
. -
bind
Likebind(Object)
, but allows to provide options for the handler runner. This allows to configure for the Java API the executor where to run the handler code, or the Kotlin API the coroutine context.Look at the respective documentations of the HandlerRunner class in the Java or in the Kotlin module.
If you want to modify some of the service definition options, such as documentation, inactivity timeout, and so on, use
bind(Object, HandlerRunner.Options, Consumer)
instead.- See Also:
-
bind
Same asbind(Object)
but allows to configure theServiceDefinition
before binding it.Endpoint endpoint = Endpoint .builder() .bind( new Counter(), // Configure the service s -> s.journalRetention(Duration.ofDays(1)) ) .build();
- See Also:
-
bind
public Endpoint.Builder bind(Object service, HandlerRunner.Options options, Consumer<ServiceDefinition.Configurator> configurator) Same asbind(Object, HandlerRunner.Options)
but allows to configure theServiceDefinition
before binding it.- See Also:
-
bind
Add a manualServiceDefinition
to the endpoint. -
withOpenTelemetry
Set theOpenTelemetry
implementation for tracing and metrics.- See Also:
-
setOpenTelemetry
public void setOpenTelemetry(io.opentelemetry.api.OpenTelemetry openTelemetry) Same aswithOpenTelemetry(OpenTelemetry)
. -
getOpenTelemetry
public io.opentelemetry.api.OpenTelemetry getOpenTelemetry()- Returns:
- the configured
OpenTelemetry
-
withRequestIdentityVerifier
public Endpoint.Builder withRequestIdentityVerifier(RequestIdentityVerifier requestIdentityVerifier) Set the request identity verifier for this endpoint.For the Restate implementation to use with Restate Cloud, check the module
sdk-request-identity
. -
setRequestIdentityVerifier
-
getRequestIdentityVerifier
- Returns:
- the configured request identity verifier
-
enablePreviewContext
-
build
-