Package groovy.concurrent

# Interface ReactorHandler<T,R>

Type Parameters:
  `T` - the message type
  `R` - the reply type

Functional Interface:
  This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ReactorHandler<T,R>
Context-aware handler for reactor actors. Receives the actor context and the incoming message; returns the reply value bound to `Actor.sendAndGet(T)` callers.

To stop the actor from inside the handler, call `ctx.self().stop()`.

Since:
  6.0.0
See Also:
  - `Actor.reactor(ReactorHandler)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `R`
  `apply(ActorContext<T> ctx, T message)`
  Processes a single message and returns the reply.

- ## Method Details

  - ### apply

    R apply(ActorContext<T> ctx, T message)
    Processes a single message and returns the reply.
    Parameters:
      `ctx` - the actor context
      `message` - the incoming message
    Returns:
      the reply value