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

java-spring-reliable-timers sample is broken #1857

Closed
aludwiko opened this issue Nov 14, 2023 · 3 comments
Closed

java-spring-reliable-timers sample is broken #1857

aludwiko opened this issue Nov 14, 2023 · 3 comments
Labels
bug Something isnt working java-sdk

Comments

@aludwiko
Copy link
Contributor

I'm not sure if this is some form of regression, but I get a timeout when running the command from the Readme:

⋊> ~ curl -XPOST -H "Content-Type: application/json" localhost:9000/orders/place -d '{ "item":"Pizza Margherita", "quantity":1 }'                                                                   16:12:42

The server was not able to produce a timely response to your request.
Please try again in a short while!⏎

The logic behind it is quite specific:

@PostMapping("/place")
  public Effect<Order> placeOrder(@RequestBody OrderRequest orderRequest) {

    var orderId = UUID.randomUUID().toString(); // <1>

    CompletionStage<Done> timerRegistration = // <2>
        timers().startSingleTimer(
          timerName(orderId), // <3>
          Duration.ofSeconds(10), // <4>
          componentClient.forAction().call(OrderAction::expire).params(orderId) // <5>
        );

    var request = componentClient.forValueEntity(orderId).call(OrderEntity::placeOrder).params(orderRequest); // <6>
    return effects().asyncReply( // <7>
        timerRegistration
            .thenCompose(done -> request.execute())
            .thenApply(order -> order)
    );
  }

Adding the timer works fine, but the next request is never called. Calling only the entity (without the timer) also works fine.

@aludwiko
Copy link
Contributor Author

It works as expected with sdk 1.3.3

@octonato
Copy link
Member

I tested it and I can confirm that it happens when we use the ComponentClient.

It might be that I introduced a bug in #1817

@ennru ennru added bug Something isnt working java-sdk labels Nov 23, 2023
@aludwiko
Copy link
Contributor Author

fixed in: #1861

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isnt working java-sdk
Projects
None yet
Development

No branches or pull requests

4 participants