Using Generics in QueryHandler response error

Hello,

We are having issues when our QueryHandler is returning a Class with a Generic parameter (like QueryResult). Axon is giving us the following message:

NoHandlerForQueryException: No handler found for [xxxQuery] with response type [InstanceResponseType{class QueryResult}]

Is using Generics allowed in QueryHandlers or do we have to call queryGateway in some specific way?

Regards,

Rob

Hi Rob,

we currently don’t support generics yet. The only place where we do support them is when returning a List or Future.

You could implement your own “ResponseType” by implementing the org.axonframework.messaging.responsetypes.ResponseType interface. Make sure both sender and recipient have the class, though.

Cheers,