From 1500e34b90944e6c4bc3bcb8ab9b0e11c7e5ea2a Mon Sep 17 00:00:00 2001 From: Giselle van Dongen Date: Fri, 22 Nov 2024 11:12:57 +0100 Subject: [PATCH] Clean imports --- .../src/main/java/my/example/Greeter.java | 30 +++++++++---------- .../com/example/restatestarter/Greeter.java | 3 -- templates/rust-shuttle/src/main.rs | 5 ++-- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/templates/java-gradle/src/main/java/my/example/Greeter.java b/templates/java-gradle/src/main/java/my/example/Greeter.java index 77253007..b0689535 100644 --- a/templates/java-gradle/src/main/java/my/example/Greeter.java +++ b/templates/java-gradle/src/main/java/my/example/Greeter.java @@ -13,21 +13,21 @@ @Service public class Greeter { - @Handler - public String greet(Context ctx, String name) { - // Durably execute a set of steps; resilient against failures - String greetingId = ctx.random().nextUUID().toString(); - ctx.run(() -> sendNotification(greetingId, name)); - ctx.sleep(Duration.ofMillis(1000)); - ctx.run(() -> sendReminder(greetingId)); + @Handler + public String greet(Context ctx, String name) { + // Durably execute a set of steps; resilient against failures + String greetingId = ctx.random().nextUUID().toString(); + ctx.run(() -> sendNotification(greetingId, name)); + ctx.sleep(Duration.ofMillis(1000)); + ctx.run(() -> sendReminder(greetingId)); - // Respond to caller - return "You said hi to " + name + "!"; - } + // Respond to caller + return "You said hi to " + name + "!"; + } - public static void main(String[] args) { - RestateHttpEndpointBuilder.builder() - .bind(new Greeter()) - .buildAndListen(); - } + public static void main(String[] args) { + RestateHttpEndpointBuilder.builder() + .bind(new Greeter()) + .buildAndListen(); + } } diff --git a/templates/java-maven-spring-boot/src/main/java/com/example/restatestarter/Greeter.java b/templates/java-maven-spring-boot/src/main/java/com/example/restatestarter/Greeter.java index d473b6c7..ded0a2e2 100644 --- a/templates/java-maven-spring-boot/src/main/java/com/example/restatestarter/Greeter.java +++ b/templates/java-maven-spring-boot/src/main/java/com/example/restatestarter/Greeter.java @@ -10,9 +10,6 @@ import static com.example.restatestarter.Utils.sendNotification; import static com.example.restatestarter.Utils.sendReminder; -/** - * Template of a Restate service and handler. - */ @RestateService public class Greeter { diff --git a/templates/rust-shuttle/src/main.rs b/templates/rust-shuttle/src/main.rs index 1f0bd7be..7bdca4fb 100644 --- a/templates/rust-shuttle/src/main.rs +++ b/templates/rust-shuttle/src/main.rs @@ -1,12 +1,11 @@ -use std::time::Duration; -use restate_sdk::prelude::*; - // Restate shuttle integration mod restate_shuttle; mod utils; +use restate_sdk::prelude::*; use restate_shuttle::RestateShuttleEndpoint; use utils::{send_notification, send_reminder}; +use std::time::Duration; #[restate_sdk::service] trait Greeter {