/*
 * Copyright 2017, TeamDev Ltd. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package org.spine3.server.event;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Marks a method as an event subscriber.
 *
 * <p>An event subscriber method:
 * <ul>
 *     <li>is annotated with {@link Subscribe};
 *     <li>is {@code public};
 *     <li>returns {@code void};
 *     <li>accepts an event derived from {@link com.google.protobuf.Message Message}
 *          as the first parameter;
 *     <li>(optional) accepts an {@link org.spine3.base.EventContext EventContext}
 *          as the second parameter.
 * </ul>
 *
 * If the annotation is applied to a method which doesn't satisfy any of these requirements,
 * this method is not considered as an event subscriber and is not registered for event delivery
 * from {@link EventBus}.
 *
 * @author Alexander Yevsyukov
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Subscribe {
}

@@ -1236,27 +1236,147 @@
 as a
-n event subscriber.
+ subscriber for the command output.%0A *%0A * %3Cp%3EUse it to subscribe to either events or business failures%0A *%0A * %3Ch2%3ESubscribing to Events%3C/h2%3E
 %0A *%0A
@@ -1784,16 +1784,906 @@
 %3E%0A *%0A * 
+%3Ch2%3ESubscribing to Failures%3C/h2%3E%0A *%0A * %3Cp%3EA failure subscriber method:%0A * %3Cul%3E%0A *     %3Cli%3Eis annotated with %7B@link Subscribe%7D;%0A *     %3Cli%3Eis %7B@code public%7D;%0A *     %3Cli%3Ereturns %7B@code void%7D;%0A *     %3Cli%3Eaccepts a failure derived from %7B@link com.google.protobuf.Message Message%7D%0A *          as the first parameter;%0A *     %3Cli%3Eaccepts a command derived from %7B@link com.google.protobuf.Message Message%7D%0A *          as the second parameter;%0A *     %3Cli%3E(optional) accepts an %7B@link org.spine3.base.CommandContext CommandContext%7D%0A *          as the third parameter.%0A * %3C/ul%3E%0A *%0A * %3Cp%3EThe type of the command argument specified acts as a filter. I.e.%0A * the subscriber receives the failure if:%0A * %3Cul%3E%0A *     %3Cli%3Ethe failure type matches the first argument type;%0A *     %3Cli%3Ethe command, which processing caused the failure, has the same type as the%0A *          second argument.%0A * %3C/ul%3E%0A *%0A *%0A * %3Cp%3E
 If the a
@@ -2801,23 +2801,16 @@
 red as a
-n event
  subscri
@@ -2839,21 +2839,37 @@
 red for 
-event
+the command output%0A *
  deliver
@@ -2873,30 +2873,66 @@
 very
-%0A *
  from 
-%7B@link EventB
+the relevant %7B@linkplain org.spine3.server.bus.Bus b
 us%7D.

Update the `Subscribe` annotation documentation according to the design intention.