/** * Registers the {@code callback}, which is invoked for each sent command, unless Axon is able to detect that * the result of the command does not match the type accepted by the callback. * <p/> * Axon will check the signature of the onResult() method and only invoke the callback if the actual result of the * command is an instance of that type. If Axon is unable to detect the type, the callback is always invoked, * potentially causing {@link java.lang.ClassCastException}. * * @param callback The callback to register * @param responseType The actual response type of the command * @param <R> The type of return value the callback is interested in * @return this instance for further configuration */ public <C, R> CommandGatewayFactory registerCommandCallback(CommandCallback<C, R> callback, ResponseType<R> responseType) { this.commandCallbacks.add(new TypeSafeCallbackWrapper<>(callback, responseType)); return this; }
/** * Registers the {@code callback}, which is invoked for each sent command, unless Axon is able to detect that * the result of the command does not match the type accepted by the callback. * <p/> * Axon will check the signature of the onResult() method and only invoke the callback if the actual result of the * command is an instance of that type. If Axon is unable to detect the type, the callback is always invoked, * potentially causing {@link java.lang.ClassCastException}. * * @param callback The callback to register * @param responseType The actual response type of the command * @param <R> The type of return value the callback is interested in * @return this instance for further configuration */ public <C, R> CommandGatewayFactory registerCommandCallback(CommandCallback<C, R> callback, ResponseType<R> responseType) { this.commandCallbacks.add(new TypeSafeCallbackWrapper<>(callback, responseType)); return this; }
/** * Registers the {@code callback}, which is invoked for each sent command, unless Axon is able to detect that * the result of the command does not match the type accepted by the callback. * <p/> * Axon will check the signature of the onSuccess() method and only invoke the callback if the actual result of the * command is an instance of that type. If Axon is unable to detect the type, the callback is always invoked, * potentially causing {@link java.lang.ClassCastException}. * * @param callback The callback to register * @param <R> The type of return value the callback is interested in * @return this instance for further configuration */ public <C, R> CommandGatewayFactory registerCommandCallback(CommandCallback<C, R> callback) { this.commandCallbacks.add(new TypeSafeCallbackWrapper<>(callback)); return this; }