I have the following situation:
- An action which implements a http-endpoint
- An (eventsourced) entity which implements the domain-logic.
I want to separate the (public http) API from the internal entity API.
I use the forwarding of a command as described here: here, that works fine.
This results in the entity sending the reply directly to the caller (=http client). That is fine is it’s a empty reply.
But what if I want to convert the response from the entity (domain-state) into another type (a http-response)?
I’ve added a handler which does the convertion, but how do i add it to the ‘forward chain’? The documentation states that ‘Forwards can be chained arbitrarily long’. How do I do that (with the java-API).
This is basically what I want to achieve:
receive request → convert request to command → forward command to entity → entity replies with domain-object → convert domain-object into response.