-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
I don't like passing all the app logic as lambdas because it makes the codebase messy. It would be great if Restate used an annotation-based approach instead (or something else), which would mean moving the responsibility from the caller method to the called method
What if we created a @Run annotation instead of calling ctx.run()? For example:
@Workflow
public boolean run(WorkflowContext ctx, Email email) {
String secret = ctx.random().nextUUID().toString();
ctx.set(STATUS, "Generated secret");
// ctx.run("send email", () -> sendEmailWithLink(email, secret));
sendEmailWithLink(email, secret);
ctx.set(STATUS, "Sent email");
String clickSecret =
ctx.promise(EMAIL_CLICKED)
.future()
.await();
ctx.set(STATUS, "Clicked email");
return clickSecret.equals(secret);
}
@Run("send email")
public void sendEmailWithLink(Email email, String secret) {
// ......
}That's not only for ctx.run(), it can be applied to a lot of methods.
Metadata
Metadata
Assignees
Labels
No labels