Behind the demand is the migration to java17. I had a lot of trouble to realize that. First of all I switched from xstream to jackson serializer for messages and keep xstream for the events, after writing own converter for some classes and configuring jackson I get rid of all error messages except for a new one an AsyncTimeoutException. It seems this exception is related to the query-bus. After hours with no success to resolve this issue, I switched to the SimpleQueryBus and it works. But the question is is there any disadvantages to use the SimpleQueryBus or have I pay attention of something by using that?
The SimpleQueryBus works within a single JVM, whereas the AxonServerQueryBus allows you to send and receive queries between different JVM instances.
Differently put, you’d be removing the possibility to send a query from node A to node B entirely by removing the SimpleQueryBus.
Perhaps we can find a solution to the AsyncTimeoutException you’re facing.
Can you elaborate on where this issue originated and how this combines with JDK17?
I know of several users that have moved their Axon Framework applications to JDK17 (also some internal to AxonIQ) that still use the AxonServerQueryBus.
Apart from that, I understand the trouble XStream causes with migrating to JDK17…
We will most certainly make rigorous changes in a future major release of Axon Framework to make things more friendly for the end user. My apologies for any trouble it may have caused you.
thanks for explaining. The AsnycTimeoutException combines not with jdk17, also happens with jdk11. The problem was a wrong configuration of jackson, I added a copy of the object mapper solved this issue. My final messageSerializer bean:
@Qualifier("messageSerializer")
@Bean
public Serializer messageSerializer(ObjectMapper mapper) {
ObjectMapper _mapper = mapper.copy();
Hibernate5Module m = new Hibernate5Module();
// I hoped that line would solve the problem with the lazy loaded deserialize error, but it does not
m.enable(Hibernate5Module.Feature.FORCE_LAZY_LOADING);
_mapper.registerModule(m);
_mapper.activateDefaultTyping(_mapper.getPolymorphicTypeValidator(), ObjectMapper.DefaultTyping.NON_CONCRETE_AND_ARRAYS);
return JacksonSerializer.builder()
.objectMapper(_mapper)
.lenientDeserialization()
.build();
}
But was followed was a lazy loaded deserialize error. For example in my projection class exists a QueryHandler like that:
@QueryHandler
public CollectionModel<CarParkResponse> handle(ListCarParks query) {
if (query.getFilter().isPresent()) {
Pageable request = Pagination.of(query.getFilter().get());
return assembler.setExpand(query.getExpand()).toCollectionModel(carParkService.carparks(request, Pagination.getFilter()));
}
return assembler.setExpand(query.getExpand()).toCollectionModel(carParkService.carparks());
}
And the RepresentationModelAssmbler had before lazy loaded the expands like this way:
@Override
public CarParkResponse toModel(@NotNull CarParkView entity) {
CarParkResponse model = instantiateModel(entity);
....
if (expand.contains("templates")) {
Hibernate.initialize(entity.getTemplates());
model.setTemplates(entity.getTemplates());
}
...
return model;
}
I don’t know why this Code worked before with xtream as messageSerializer and not with jackson.
I removed the Hibernate.initialize part and changed it to that what works for me:
if (expand.contains("templates")) {
model.setTemplates(service.templatesByCarpark(entity));
}
With that the project is completely migrated to jdk17 and use the AxonServerQueryBus again