View Javadoc

1   package com.atlassian.messagequeue.registry;
2   
3   import com.atlassian.annotations.PublicSpi;
4   import com.atlassian.messagequeue.MessageRunnerService;
5   
6   /**
7    * Message Runner SPI. Implementations of Message Runners should implement this interface.
8    * @since 1.0
9    */
10  @PublicSpi
11  public interface MessageRunner {
12  
13      /**
14       * <p>
15       *     Entry point for running this message.
16       * </p>
17       * <p>
18       *     A WorkContext and tenant context (as per the workcontext api) will be established before processMessage()
19       *     is called. This workcontext will be forcibly torn down when processMessage() returns.
20       * </p>
21       * <p>
22       *     To signify success or failure, a message should communicate via some token in its payload - eg the ID of a DB
23       *     record.
24       * </p>
25       * <p>
26       *     If an exception is thrown by an implementor of this method, the message system may retry processing the
27       *     message later. Whether retries are attempted, the number of retries, and the interval between retries
28       *     is up to the configuration of the {@link MessageRunnerService} implementation.
29       * <p>
30       * @param context Message execution context
31       */
32      void processMessage(MessageContext context);
33  }