Hi,
We’re trying to use a subscription query in our RestController to “fake” a sync call.
In our projector (writes to a JPA repository) we emit the the query update. Our logging and some debugging also suggests that the update is send as expected.
However our subscriptionQuery never seems to receive the update.
Most of our logic is based on this example: https://github.com/fransvanbuul/axon-sync-rest-frontend
However in our rest controller we first execute a query to get the current object (we need it in the command). So we try to do the following:
final GetPEConceptById getPEConceptById = new GetPEConceptById(ExternalId.fromString(id));
SubscriptionQueryResult<PEConcept, PEConcept> queryResult = queryGateway.subscriptionQuery(
getPEConceptById,
ResponseTypes.instanceOf(PEConcept.class),
ResponseTypes.instanceOf(PEConcept.class));
/* Sending the command to update the concept. */
try{
log.info("getting current current concept and sending command");
queryGateway.query(getPEConceptById, ResponseTypes.instanceOf(PEConcept.class)).thenAccept(
c -> sendReplaceCommand(peConceptResponse, c));
return queryResult.updates().blockFirst(Duration.ofSeconds(10));
} finally {
log.info("Closing subscription query");
queryResult.close();
}
The query return the proper concept and the command is send.
We have 2 eventhandlers that process the event generated by the command. One updates the projection (and emits the update via the queryUpdateEmitter) and one sends the some data to an external system.
I don’t really get why this should not work as expected.
Is there any way we can debug this issue further?
Any insight would be great!
Thanks,
Danny