Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert the Tour to new API and general improvements #348

Merged
merged 9 commits into from
Apr 18, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address feedback
gvdongen committed Apr 18, 2024
commit 7360b536c0f6032d8015c14ca0c313a0ecb2c193
12 changes: 3 additions & 9 deletions code_snippets/java/src/main/java/get_started/Tour.java
Original file line number Diff line number Diff line change
@@ -34,20 +34,13 @@ public boolean handle(Context ctx, CheckoutRequest request) {
String idempotencyKey = ctx.random().nextUUID().toString();
System.out.println("My idempotency key: " + idempotencyKey);

TourUtils.fail();

return true;
throw new IllegalStateException("The handler failed");
}
// <end_uuid>

public static void main(String[] args) {
RestateHttpEndpointBuilder.builder().bind(new Tour()).bind(new TicketObject()).buildAndListen();
}

static class TourUtils {
public static void fail() {
}
}
}

@Service
@@ -61,7 +54,8 @@ public boolean handle(Context ctx, CheckoutRequest request) {
String idempotencyKey = ctx.random().nextUUID().toString();

// withClass highlight-line
boolean success = ctx.sideEffect(CoreSerdes.JSON_BOOLEAN, () -> PaymentClient.get().call(idempotencyKey, totalPrice));
boolean success = ctx.sideEffect(CoreSerdes.JSON_BOOLEAN, () ->
PaymentClient.get().call(idempotencyKey, totalPrice));

return success;
}
Loading