Axon CommandCallback

Hi,

Can you explain how is this CommandCallback works,
Below is a sample code I wrote but I never get any response.

CommandCallback commandCallback = new CommandCallback() {
    @Override
    public void onSuccess(CommandMessage commandMessage, Object result) {
        System.out.println("PatientServiceImpl.onSuccess");
    }

    @Override
    public void onFailure(CommandMessage commandMessage, Throwable cause) {
        System.out.println("PatientServiceImpl.onFailure");
    }
};

gateway.send(command,commandCallback);

The callback can be used when invoking the commandgateway so you can assert something on the result of the command execution

`

commandGateway.send(command, new CommandCallback<TheCommand, Object>() {
@Override
public void onSuccess(CommandMessage<? extends TheCommand> commandMessage,
Object result) {
LOG.info(“SUCCESS”);
}

@Override
public void onFailure(CommandMessage<? extends TheCommand> commandMessage,
Throwable cause) {
LOG.info(“FAILED”);
}
});

`

HTH
Jorg
.