/*
 * Copyright (c) 2010-2020. Axon Framework
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.axonframework.commandhandling.gateway;

import org.axonframework.messaging.Message;
import reactor.core.publisher.Mono;

/**
 * Variation of {@link CommandGateway}. Provides support for reactive return type such as {@link Mono} from Project
 * Reactor.
 *
 * @author Milan Savic
 * @since 4.4
 */
public interface ReactiveCommandGateway {

    /**
     * Sends the given {@code command} once the caller subscribes to the command result. Returns immediately.
     * <p/>
     * The given {@code command} is wrapped as the payload of the CommandMessage that is eventually posted on the
     * Command Bus, unless Command already implements {@link Message}. In that case, a
     * CommandMessage is constructed from that message's payload and MetaData.
     *
     * @param command the command to dispatch
     * @param <R>     the type of the command result
     * @return a {@link Mono} which is resolved when the command is executed
     */
    default <R> Mono<R> send(Object command) {
        return send(Mono.just(command));
    }

    /**
     * Sends the given {@code command} once the caller subscribes to the command result. Returns immediately.
     *
     * @param command a {@link Mono} which is resolved once the caller subscribes to the command result
     * @param <R>     the type of the command result
     * @return a {@link Mono} which is resolved when the command is executed
     * @see #send(Object)
     */
    <R> Mono<R> send(Mono<Object> command);
}

@@ -1146,19 +1146,24 @@
 load of 
-the
+a %7B@link
  Command
@@ -1169,16 +1169,17 @@
 dMessage
+%7D
  that is
@@ -1210,24 +1210,31 @@
 e%0A     *
+ %7B@link
  Command
  Bus, un
@@ -1229,12 +1229,12 @@
 mand
- 
 Bus
+%7D
 , un
@@ -1238,23 +1238,35 @@
  unless 
-C
+the %7B@code c
 ommand
+%7D
  already
@@ -1316,16 +1316,23 @@
 a%0A     *
+ %7B@code
  Command
@@ -1338,16 +1338,17 @@
 dMessage
+%7D
  is cons
@@ -1391,16 +1391,23 @@
 and 
+%7B@link 
 MetaData
 .%0A  
@@ -1402,16 +1402,17 @@
 MetaData
+%7D
 .%0A     *

Update messaging/src/main/java/org/axonframework/commandhandling/gateway/ReactiveCommandGateway.java