FutureCallback returns null on get()

I’ve looked at the documentation for FutureCallback and it looks pretty straightforward, so I assume I’m missing something.
I’m sending a command and callback to the CommandGateway to update the DeviceAggregate.
In the log messages, deviceFutures.isDone() is true, but null is returned from the deviceFuture.get().
Am I wrong to assume I should be getting the aggregate returned on the future get? It does not throw any axon exceptions.

I have this basic code :
`

FutureCallback deviceFuture = new FutureCallback()

gw.send(deviceCmd, deviceFuture);
DeviceAggregate deviceAgg = null;

try {

log.debug(“device command done? {}”,deviceFuture.isDone());

deviceAgg = deviceFuture.get();

log.debug(“deviceAggId returned : {}”,deviceAgg);

if (deviceAgg == null) {

String error = String.format(“device aggregate enroll failed for deviceId %s”,deviceCmd.getDeviceId());

log.debug(error);

throw new EnrollmentException(error);

}

} catch (ExecutionException e) {

throw new EnrollmentException(String.format(“Enrollment failed with error %s”, e.getMessage()));

} catch (InterruptedException e) {

throw new EnrollmentException(String.format(“Enrollment failed with error %s”, e.getMessage()));

}

`

Hi,

if you command handler has a void return type, the return value is always null. FutureCallback.get() will always return the value returned by the @CommandHandler method.
Only for constructor command handlers (on aggregates), Axon will, by default, return the identifier of the aggregate that was created.

Returning an aggregate from a command handler wouldn’t make sense, as the command model isn’t built to expose any state. There is nothing you could do with that aggregate.

Cheers,

Allard