diff --git a/MIGRATION.md b/MIGRATION.md index 9e901050..9acb68a2 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -29,12 +29,12 @@ one service at a time. | `ctx.key()` | `Restate.key()` | | `ctx.promise(key)` / `ctx.promiseHandle(key)` | `Restate.promise(key)` / `Restate.promiseHandle(key)` | | `ctx.invocationHandle(id, ...)` | `Restate.invocationHandle(id, ...)` | -| Code-generated clients (Service) | `Restate.service(Class)` / `Restate.toService(Class)` | -| Code-generated clients (Virtual Object) | `Restate.virtualObject(Class, key)` / `Restate.toVirtualObject(Class, key)` | -| Code-generated clients (Workflow) | `Restate.workflow(Class, key)` / `Restate.toWorkflow(Class, key)` | +| Code-generated clients (Service) | `Restate.service(Class)` / `Restate.serviceHandle(Class)` | +| Code-generated clients (Virtual Object) | `Restate.virtualObject(Class, key)` / `Restate.virtualObjectHandle(Class, key)` | +| Code-generated clients (Workflow) | `Restate.workflow(Class, key)` / `Restate.workflowHandle(Class, key)` | From **outside** a handler (the ingress client), the equivalents live on `dev.restate.client.Client`: -`client.service(Class)` / `client.toService(Class)` / `client.virtualObject(Class, key)` / etc. +`client.service(Class)` / `client.serviceHandle(Class)` / `client.virtualObject(Class, key)` / etc. ### Kotlin: `Context` API → top-level functions @@ -129,16 +129,16 @@ Restate.virtualObject(Counter.class, "my-key").add(1); ```java // call() with a method reference returns a DurableFuture you can await and/or compose -int count = Restate.toVirtualObject(Counter.class, "my-counter") +int count = Restate.virtualObjectHandle(Counter.class, "my-counter") .call(Counter::increment) .await(); // send() for one-way invocation without waiting -InvocationHandle handle = Restate.toVirtualObject(Counter.class, "my-counter") +InvocationHandle handle = Restate.virtualObjectHandle(Counter.class, "my-counter") .send(Counter::increment); // Invocation options such as an idempotency key -int idempotentCount = Restate.toVirtualObject(Counter.class, "my-counter") +int idempotentCount = Restate.virtualObjectHandle(Counter.class, "my-counter") .call(Counter::increment, InvocationOptions.idempotencyKey("my-idempotency-key")) .await(); ``` diff --git a/client-kotlin/src/main/kotlin/dev/restate/client/kotlin/ingress.kt b/client-kotlin/src/main/kotlin/dev/restate/client/kotlin/ingress.kt index 9179b2d3..87b3f8e1 100644 --- a/client-kotlin/src/main/kotlin/dev/restate/client/kotlin/ingress.kt +++ b/client-kotlin/src/main/kotlin/dev/restate/client/kotlin/ingress.kt @@ -330,7 +330,12 @@ internal constructor( return service(client, SVC::class.java, scopeKey) } - /** @see Client.virtualObject */ + /** + * *NOTE:* To use scopes with virtual objects you must enable the additional experimental feature + * in restate-server, via `RESTATE_EXPERIMENTAL_ENABLE_SCOPED_VIRTUAL_OBJECTS=true`. + * + * @see Client.virtualObject + */ @org.jetbrains.annotations.ApiStatus.Experimental inline fun virtualObject(key: String): SVC { return virtualObject(client, SVC::class.java, key, scopeKey) @@ -352,7 +357,12 @@ internal constructor( return KClientRequestBuilder(client, SVC::class.java, null, scopeKey) } - /** @see Client.toVirtualObject */ + /** + * *NOTE:* To use scopes with virtual objects you must enable the additional experimental feature + * in restate-server, via `RESTATE_EXPERIMENTAL_ENABLE_SCOPED_VIRTUAL_OBJECTS=true`. + * + * @see Client.toVirtualObject + */ @org.jetbrains.annotations.ApiStatus.Experimental inline fun toVirtualObject(key: String): KClientRequestBuilder { ReflectionUtils.mustHaveVirtualObjectAnnotation(SVC::class.java) diff --git a/client/src/main/java/dev/restate/client/Client.java b/client/src/main/java/dev/restate/client/Client.java index d52e8025..22b95d9c 100644 --- a/client/src/main/java/dev/restate/client/Client.java +++ b/client/src/main/java/dev/restate/client/Client.java @@ -646,11 +646,11 @@ default SVC service(Class clazz) { * Client client = Client.connect("http://localhost:8080"); * * // Use call() with method reference and wait for the result - * Response response = client.toService(Greeter.class) + * Response response = client.serviceHandle(Greeter.class) * .call(Greeter::greet, new Greeting("Alice")); * * // Use send() for one-way invocation without waiting - * SendResponse sendResponse = client.toService(Greeter.class) + * SendResponse sendResponse = client.serviceHandle(Greeter.class) * .send(Greeter::greet, new Greeting("Alice")); * } * @@ -660,7 +660,7 @@ default SVC service(Class clazz) { * @param clazz the service class annotated with {@link Service} * @return a handle to invoke the service with advanced options */ - default ClientServiceHandle toService(Class clazz) { + default ClientServiceHandle serviceHandle(Class clazz) { ReflectionUtils.mustHaveServiceAnnotation(clazz); if (ReflectionUtils.isKotlinClass(clazz)) { throw new IllegalArgumentException("Using Kotlin classes with Java's API is not supported"); @@ -668,14 +668,6 @@ default ClientServiceHandle toService(Class clazz) { return new ClientServiceHandleImpl<>(this, clazz, null); } - /** - * @deprecated Renamed to {@link #toService(Class)}. - */ - @Deprecated(since = "2.9", forRemoval = true) - default ClientServiceHandle serviceHandle(Class clazz) { - return toService(clazz); - } - /** * Simple API to invoke a Restate Virtual Object from the ingress. * @@ -691,8 +683,8 @@ default ClientServiceHandle serviceHandle(Class clazz) { * } * *

For advanced use cases requiring asynchronous request handling, access to {@link Response} - * metadata, or invocation options (such as idempotency keys), use {@link #toVirtualObject(Class, - * String)} instead. + * metadata, or invocation options (such as idempotency keys), use {@link + * #virtualObjectHandle(Class, String)} instead. * * @param clazz the virtual object class annotated with {@link VirtualObject} * @param key the key identifying the specific virtual object instance @@ -736,11 +728,11 @@ default SVC virtualObject(Class clazz, String key) { * Client client = Client.connect("http://localhost:8080"); * * // Use call() with method reference and wait for the result - * Response response = client.toVirtualObject(Counter.class, "my-counter") + * Response response = client.virtualObjectHandle(Counter.class, "my-counter") * .call(Counter::increment); * * // Use send() for one-way invocation without waiting - * SendResponse sendResponse = client.toVirtualObject(Counter.class, "my-counter") + * SendResponse sendResponse = client.virtualObjectHandle(Counter.class, "my-counter") * .send(Counter::increment); * } * @@ -751,7 +743,7 @@ default SVC virtualObject(Class clazz, String key) { * @param key the key identifying the specific virtual object instance * @return a handle to invoke the virtual object with advanced options */ - default ClientServiceHandle toVirtualObject(Class clazz, String key) { + default ClientServiceHandle virtualObjectHandle(Class clazz, String key) { ReflectionUtils.mustHaveVirtualObjectAnnotation(clazz); if (ReflectionUtils.isKotlinClass(clazz)) { throw new IllegalArgumentException("Using Kotlin classes with Java's API is not supported"); @@ -759,14 +751,6 @@ default ClientServiceHandle toVirtualObject(Class clazz, String return new ClientServiceHandleImpl<>(this, clazz, key); } - /** - * @deprecated Renamed to {@link #toVirtualObject(Class, String)}. - */ - @Deprecated(since = "2.9", forRemoval = true) - default ClientServiceHandle virtualObjectHandle(Class clazz, String key) { - return toVirtualObject(clazz, key); - } - /** * Simple API to invoke a Restate Workflow from the ingress. * @@ -782,7 +766,7 @@ default ClientServiceHandle virtualObjectHandle(Class clazz, Str * } * *

For advanced use cases requiring asynchronous request handling, access to {@link Response} - * metadata, or invocation options (such as idempotency keys), use {@link #toWorkflow(Class, + * metadata, or invocation options (such as idempotency keys), use {@link #workflowHandle(Class, * String)} instead. * * @param clazz the workflow class annotated with {@link Workflow} @@ -827,11 +811,11 @@ default SVC workflow(Class clazz, String key) { * Client client = Client.connect("http://localhost:8080"); * * // Use call() with method reference and wait for the result - * Response response = client.toWorkflow(OrderWorkflow.class, "order-123") + * Response response = client.workflowHandle(OrderWorkflow.class, "order-123") * .call(OrderWorkflow::start, new OrderRequest(...)); * * // Use send() for one-way invocation without waiting - * SendResponse sendResponse = client.toWorkflow(OrderWorkflow.class, "order-123") + * SendResponse sendResponse = client.workflowHandle(OrderWorkflow.class, "order-123") * .send(OrderWorkflow::start, new OrderRequest(...)); * } * @@ -842,7 +826,7 @@ default SVC workflow(Class clazz, String key) { * @param key the key identifying the specific workflow instance * @return a handle to invoke the workflow with advanced options */ - default ClientServiceHandle toWorkflow(Class clazz, String key) { + default ClientServiceHandle workflowHandle(Class clazz, String key) { ReflectionUtils.mustHaveWorkflowAnnotation(clazz); if (ReflectionUtils.isKotlinClass(clazz)) { throw new IllegalArgumentException("Using Kotlin classes with Java's API is not supported"); @@ -850,14 +834,6 @@ default ClientServiceHandle toWorkflow(Class clazz, String key) return new ClientServiceHandleImpl<>(this, clazz, key); } - /** - * @deprecated Renamed to {@link #toWorkflow(Class, String)}. - */ - @Deprecated(since = "2.9", forRemoval = true) - default ClientServiceHandle workflowHandle(Class clazz, String key) { - return toWorkflow(clazz, key); - } - /** * Create a default JDK client. * diff --git a/client/src/main/java/dev/restate/client/ClientServiceHandle.java b/client/src/main/java/dev/restate/client/ClientServiceHandle.java index 39019a44..12860880 100644 --- a/client/src/main/java/dev/restate/client/ClientServiceHandle.java +++ b/client/src/main/java/dev/restate/client/ClientServiceHandle.java @@ -34,16 +34,16 @@ * Client client = Client.connect("http://localhost:8080"); * * // 1. Use call() with method reference and wait for the result - * Response response = client.toService(Greeter.class) + * Response response = client.serviceHandle(Greeter.class) * .call(Greeter::greet, new Greeting("Alice")); * * // 2. Use send() for one-way invocation without waiting - * SendResponse sendResponse = client.toService(Greeter.class) + * SendResponse sendResponse = client.serviceHandle(Greeter.class) * .send(Greeter::greet, new Greeting("Alice")); * } * - *

Create instances using {@link Client#toService(Class)}, {@link Client#toVirtualObject(Class, - * String)}, or {@link Client#toWorkflow(Class, String)}. + *

Create instances using {@link Client#serviceHandle(Class)}, {@link + * Client#virtualObjectHandle(Class, String)}, or {@link Client#workflowHandle(Class, String)}. * *

For simple synchronous request-response interactions returning just the output, consider using * the simple proxy API instead: {@link Client#service(Class)}, {@link Client#virtualObject(Class, diff --git a/client/src/main/java/dev/restate/client/ScopedClient.java b/client/src/main/java/dev/restate/client/ScopedClient.java index 974b73e7..dbacc823 100644 --- a/client/src/main/java/dev/restate/client/ScopedClient.java +++ b/client/src/main/java/dev/restate/client/ScopedClient.java @@ -73,6 +73,9 @@ public ClientServiceHandle serviceHandle(Class clazz) { } /** + * NOTE: To use scopes with virtual objects you must enable the additional experimental + * feature in restate-server, via {@code RESTATE_EXPERIMENTAL_ENABLE_SCOPED_VIRTUAL_OBJECTS=true} + * * @see Client#virtualObject(Class, String) */ @org.jetbrains.annotations.ApiStatus.Experimental @@ -100,6 +103,9 @@ public SVC virtualObject(Class clazz, String key) { } /** + * NOTE: To use scopes with virtual objects you must enable the additional experimental + * feature in restate-server, via {@code RESTATE_EXPERIMENTAL_ENABLE_SCOPED_VIRTUAL_OBJECTS=true} + * * @see Client#virtualObjectHandle(Class, String) */ @org.jetbrains.annotations.ApiStatus.Experimental diff --git a/examples/src/main/java/my/restate/sdk/examples/LoanWorkflow.java b/examples/src/main/java/my/restate/sdk/examples/LoanWorkflow.java index df5fec2a..ab8f0a8c 100644 --- a/examples/src/main/java/my/restate/sdk/examples/LoanWorkflow.java +++ b/examples/src/main/java/my/restate/sdk/examples/LoanWorkflow.java @@ -84,7 +84,7 @@ public String run(LoanRequest loanRequest) { Instant executionTime; try { executionTime = - Restate.toService(MockBank.class) + Restate.serviceHandle(MockBank.class) .call( MockBank::transfer, new TransferRequest(loanRequest.customerBankAccount(), loanRequest.amount())) @@ -145,7 +145,7 @@ public static void main(String[] args) { LoanWorkflow loanWorkflow = restateClient.workflow(LoanWorkflow.class, "my-loan"); var handle = restateClient - .toWorkflow(LoanWorkflow.class, "my-loan") + .workflowHandle(LoanWorkflow.class, "my-loan") .send( LoanWorkflow::run, new LoanRequest( diff --git a/sdk-api-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/api.kt b/sdk-api-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/api.kt index f42b3ec3..b46a1ce9 100644 --- a/sdk-api-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/api.kt +++ b/sdk-api-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/api.kt @@ -1361,6 +1361,7 @@ class KRequestBuilder internal constructor( private val clazz: Class, private val key: String?, + private val scope: String? = null, ) { /** * Create a request by invoking a method on the target. @@ -1374,7 +1375,7 @@ internal constructor( @Suppress("UNCHECKED_CAST") suspend fun request(block: suspend SVC.() -> Res): KRequest { return KRequestImpl( - RequestCaptureProxy(clazz, key).capture(block as suspend SVC.() -> Any?).toRequest() + RequestCaptureProxy(clazz, key, scope).capture(block as suspend SVC.() -> Any?).toRequest() ) as KRequest } @@ -1542,7 +1543,12 @@ internal constructor( return service(SVC::class.java, scopeKey) } - /** @see virtualObject */ + /** + * *NOTE:* To use scopes with virtual objects you must enable the additional experimental feature + * in restate-server, via `RESTATE_EXPERIMENTAL_ENABLE_SCOPED_VIRTUAL_OBJECTS=true`. + * + * @see virtualObject + */ @org.jetbrains.annotations.ApiStatus.Experimental suspend inline fun virtualObject(key: String): SVC { return virtualObject(SVC::class.java, key, scopeKey) @@ -1553,6 +1559,41 @@ internal constructor( suspend inline fun workflow(key: String): SVC { return workflow(SVC::class.java, key, scopeKey) } + + /** @see toService */ + @org.jetbrains.annotations.ApiStatus.Experimental + inline fun toService(): KRequestBuilder { + ReflectionUtils.mustHaveServiceAnnotation(SVC::class.java) + require(ReflectionUtils.isKotlinClass(SVC::class.java)) { + "Using Java classes with Kotlin's API is not supported" + } + return KRequestBuilder(SVC::class.java, null, scopeKey) + } + + /** + * *NOTE:* To use scopes with virtual objects you must enable the additional experimental feature + * in restate-server, via `RESTATE_EXPERIMENTAL_ENABLE_SCOPED_VIRTUAL_OBJECTS=true`. + * + * @see toVirtualObject + */ + @org.jetbrains.annotations.ApiStatus.Experimental + inline fun toVirtualObject(key: String): KRequestBuilder { + ReflectionUtils.mustHaveVirtualObjectAnnotation(SVC::class.java) + require(ReflectionUtils.isKotlinClass(SVC::class.java)) { + "Using Java classes with Kotlin's API is not supported" + } + return KRequestBuilder(SVC::class.java, key, scopeKey) + } + + /** @see toWorkflow */ + @org.jetbrains.annotations.ApiStatus.Experimental + inline fun toWorkflow(key: String): KRequestBuilder { + ReflectionUtils.mustHaveWorkflowAnnotation(SVC::class.java) + require(ReflectionUtils.isKotlinClass(SVC::class.java)) { + "Using Java classes with Kotlin's API is not supported" + } + return KRequestBuilder(SVC::class.java, key, scopeKey) + } } /** diff --git a/sdk-api/src/main/java/dev/restate/sdk/Restate.java b/sdk-api/src/main/java/dev/restate/sdk/Restate.java index 8ccbd4f4..06d45217 100644 --- a/sdk-api/src/main/java/dev/restate/sdk/Restate.java +++ b/sdk-api/src/main/java/dev/restate/sdk/Restate.java @@ -455,7 +455,7 @@ public static DurableFuture timer(Duration duration) { * } * *

For advanced use cases requiring asynchronous request handling, composable futures, or - * invocation options (such as idempotency keys), use {@link #toService(Class)} instead. + * invocation options (such as idempotency keys), use {@link #serviceHandle(Class)} instead. * * @param clazz the service class annotated with {@link Service} * @return a proxy client to invoke the service @@ -495,12 +495,12 @@ public static SVC service(Class clazz) { * *

{@code
    * // 1. Use call() with method reference and await the result
-   * GreetingResponse response = Restate.toService(Greeter.class)
+   * GreetingResponse response = Restate.serviceHandle(Greeter.class)
    *   .call(Greeter::greet, new Greeting("Alice"))
    *   .await();
    *
    * // 2. Use send() for one-way invocation without waiting
-   * InvocationHandle handle = Restate.toService(Greeter.class)
+   * InvocationHandle handle = Restate.serviceHandle(Greeter.class)
    *   .send(Greeter::greet, new Greeting("Alice"));
    * }
* @@ -510,19 +510,11 @@ public static SVC service(Class clazz) { * @param clazz the service class annotated with {@link Service} * @return a handle to invoke the service with advanced options */ - public static ServiceHandle toService(Class clazz) { + public static ServiceHandle serviceHandle(Class clazz) { ReflectionUtils.mustHaveServiceAnnotation(clazz); return new ServiceHandleImpl<>(clazz, null); } - /** - * @deprecated Renamed to {@link #toService(Class)}. - */ - @Deprecated(since = "2.9", forRemoval = true) - public static ServiceHandle serviceHandle(Class clazz) { - return toService(clazz); - } - /** * Simple API to invoke a Restate Virtual Object. * @@ -535,7 +527,7 @@ public static ServiceHandle serviceHandle(Class clazz) { * } * *

For advanced use cases requiring asynchronous request handling, composable futures, or - * invocation options (such as idempotency keys), use {@link #toVirtualObject(Class, String)} + * invocation options (such as idempotency keys), use {@link #virtualObjectHandle(Class, String)} * instead. * * @param clazz the virtual object class annotated with {@link VirtualObject} @@ -577,12 +569,12 @@ public static SVC virtualObject(Class clazz, String key) { * *

{@code
    * // 1. Use call() with method reference and await the result
-   * int count = Restate.toVirtualObject(Counter.class, "my-counter")
+   * int count = Restate.virtualObjectHandle(Counter.class, "my-counter")
    *   .call(Counter::increment)
    *   .await();
    *
    * // 2. Use send() for one-way invocation without waiting
-   * InvocationHandle handle = Restate.toVirtualObject(Counter.class, "my-counter")
+   * InvocationHandle handle = Restate.virtualObjectHandle(Counter.class, "my-counter")
    *   .send(Counter::increment);
    * }
* @@ -593,19 +585,11 @@ public static SVC virtualObject(Class clazz, String key) { * @param key the key identifying the specific virtual object instance * @return a handle to invoke the virtual object with advanced options */ - public static ServiceHandle toVirtualObject(Class clazz, String key) { + public static ServiceHandle virtualObjectHandle(Class clazz, String key) { ReflectionUtils.mustHaveVirtualObjectAnnotation(clazz); return new ServiceHandleImpl<>(clazz, key); } - /** - * @deprecated Renamed to {@link #toVirtualObject(Class, String)}. - */ - @Deprecated(since = "2.9", forRemoval = true) - public static ServiceHandle virtualObjectHandle(Class clazz, String key) { - return toVirtualObject(clazz, key); - } - /** * Simple API to invoke a Restate Workflow. * @@ -618,7 +602,8 @@ public static ServiceHandle virtualObjectHandle(Class clazz, Str * } * *

For advanced use cases requiring asynchronous request handling, composable futures, or - * invocation options (such as idempotency keys), use {@link #toWorkflow(Class, String)} instead. + * invocation options (such as idempotency keys), use {@link #workflowHandle(Class, String)} + * instead. * * @param clazz the workflow class annotated with {@link Workflow} * @param key the key identifying the specific workflow instance @@ -659,12 +644,12 @@ public static SVC workflow(Class clazz, String key) { * *

{@code
    * // 1. Use call() with method reference and await the result
-   * Restate.toWorkflow(OrderWorkflow.class, "order-123")
+   * Restate.workflowHandle(OrderWorkflow.class, "order-123")
    *   .call(OrderWorkflow::start, new OrderRequest(...))
    *   .await();
    *
    * // 2. Use send() for one-way invocation without waiting
-   * InvocationHandle handle = Restate.toWorkflow(OrderWorkflow.class, "order-123")
+   * InvocationHandle handle = Restate.workflowHandle(OrderWorkflow.class, "order-123")
    *   .send(OrderWorkflow::start, new OrderRequest(...));
    * }
* @@ -675,19 +660,11 @@ public static SVC workflow(Class clazz, String key) { * @param key the key identifying the specific workflow instance * @return a handle to invoke the workflow with advanced options */ - public static ServiceHandle toWorkflow(Class clazz, String key) { + public static ServiceHandle workflowHandle(Class clazz, String key) { ReflectionUtils.mustHaveWorkflowAnnotation(clazz); return new ServiceHandleImpl<>(clazz, key); } - /** - * @deprecated Renamed to {@link #toWorkflow(Class, String)}. - */ - @Deprecated(since = "2.9", forRemoval = true) - public static ServiceHandle workflowHandle(Class clazz, String key) { - return toWorkflow(clazz, key); - } - /** * PREVIEW: Returns a {@link Scope} that routes all outgoing calls within the given scope. * diff --git a/sdk-api/src/main/java/dev/restate/sdk/Scope.java b/sdk-api/src/main/java/dev/restate/sdk/Scope.java index dfb401c7..2db7a844 100644 --- a/sdk-api/src/main/java/dev/restate/sdk/Scope.java +++ b/sdk-api/src/main/java/dev/restate/sdk/Scope.java @@ -65,6 +65,9 @@ public ServiceHandle serviceHandle(Class clazz) { } /** + * NOTE: To use scopes with virtual objects you must enable the additional experimental + * feature in restate-server, via {@code RESTATE_EXPERIMENTAL_ENABLE_SCOPED_VIRTUAL_OBJECTS=true} + * * @see Restate#virtualObject(Class, String) */ @org.jetbrains.annotations.ApiStatus.Experimental @@ -89,6 +92,9 @@ public SVC virtualObject(Class clazz, String key) { } /** + * NOTE: To use scopes with virtual objects you must enable the additional experimental + * feature in restate-server, via {@code RESTATE_EXPERIMENTAL_ENABLE_SCOPED_VIRTUAL_OBJECTS=true} + * * @see Restate#virtualObjectHandle(Class, String) */ @org.jetbrains.annotations.ApiStatus.Experimental diff --git a/sdk-api/src/main/java/dev/restate/sdk/ServiceHandle.java b/sdk-api/src/main/java/dev/restate/sdk/ServiceHandle.java index f116f4c2..89552d49 100644 --- a/sdk-api/src/main/java/dev/restate/sdk/ServiceHandle.java +++ b/sdk-api/src/main/java/dev/restate/sdk/ServiceHandle.java @@ -30,17 +30,17 @@ * *
{@code
  * // 1. Use call() with method reference and await the result
- * GreetingResponse response = Restate.toService(Greeter.class)
+ * GreetingResponse response = Restate.serviceHandle(Greeter.class)
  *   .call(Greeter::greet, new Greeting("Alice"))
  *   .await();
  *
  * // 2. Use send() for one-way invocation without waiting
- * InvocationHandle handle = Restate.toService(Greeter.class)
+ * InvocationHandle handle = Restate.serviceHandle(Greeter.class)
  *   .send(Greeter::greet, new Greeting("Alice"));
  * }
* - *

Create instances using {@link Restate#toService(Class)}, {@link Restate#toVirtualObject(Class, - * String)}, or {@link Restate#toWorkflow(Class, String)}. + *

Create instances using {@link Restate#serviceHandle(Class)}, {@link + * Restate#virtualObjectHandle(Class, String)}, or {@link Restate#workflowHandle(Class, String)}. * *

For simple synchronous request-response interactions, consider using the simple proxy API * instead: {@link Restate#service(Class)}, {@link Restate#virtualObject(Class, String)}, or {@link diff --git a/sdk-core/src/test/java/dev/restate/sdk/core/javaapi/reflections/MyWorkflow.java b/sdk-core/src/test/java/dev/restate/sdk/core/javaapi/reflections/MyWorkflow.java index 1dae3f94..605c931c 100644 --- a/sdk-core/src/test/java/dev/restate/sdk/core/javaapi/reflections/MyWorkflow.java +++ b/sdk-core/src/test/java/dev/restate/sdk/core/javaapi/reflections/MyWorkflow.java @@ -19,7 +19,8 @@ public class MyWorkflow { @Workflow public void run(String myInput) { - Restate.toWorkflow(MyWorkflow.class, Restate.key()).send(MyWorkflow::sharedHandler, myInput); + Restate.workflowHandle(MyWorkflow.class, Restate.key()) + .send(MyWorkflow::sharedHandler, myInput); } @Handler