Hi. I’m trying to create a simple reactive application. I’ve written a class to handle the query operations.
I’ve written a get request controller.
`
@GetMapping(path = “”, produces = MediaType.APPLICATION_STREAM_JSON_VALUE)
public Flux<List> getOrganizationCollection() {
SubscriptionQueryResult<List, OrganizationViewModel> queryResult = subscribeToOrganizationCollection();
return queryResult.initialResult().doOnError(e -> {
throw new RuntimeException(e);
}).concatWith((Publisher<? extends List>) queryResult.updates());
}
`
encapsulate the subscriptor
`
private SubscriptionQueryResult<List, OrganizationViewModel> subscribeToOrganizationCollection() {
AllOrganizationQuery query = AllOrganizationQuery.builder().build();
SubscriptionQueryResult<List, OrganizationViewModel> queryResult = queryGateway
.subscriptionQuery(query, ResponseTypes.multipleInstancesOf(OrganizationViewModel.class),
ResponseTypes.instanceOf(OrganizationViewModel.class));
return queryResult;
}
`
the emitter
`
queryUpdateEmitter.emit(AllOrganizationQuery.class, query -> true, viewModel);
`
and at last, the query handler
`
@QueryHandler
public List handle(AllOrganizationQuery query) {
return new ArrayList(eventHappened.values());
}
`
When I do the Http request I get the following empty result
Debbuging the code, I’ve noticed that the data propperty from SubscriptionQueryResult is an view model class instance with empty values. Digging a little bit more, I’ve seen that data has been lost when Axon Serialize to binary the queryhandler result. (I’m using Jackson Serializer)
Any Idea about that?
If I work with String type instead of view model class type, it works fine
Thank you in advance