Change state after external api call

Hello,
I have the following scenario:

  1. In service impl, i receive a request
  2. I perform some validation using the state
  3. If validation succeeds, i need to make an external call (not in lagom microservice)
    ( this will be made in impl afaik, as asynchronous web service calls from persistent entity are not allowed…)
  4. if that external call is successful, i need to change the state.

I am not able to figure out how the command handler will wait for the external call to complete successfully and emit the event to change state.
Am i missing something?

I assume you can’t process any other command when waiting for the validation and completing the first command? Then I suggest that you use stashing with Akka EventSourcedBehavior. Lagom - Domain Modelling with Akka Persistence Typed

1 Like