org.appng.api.messaging

## Interface Receiver

- All Superinterfaces:
    AutoCloseable, Closeable
  All Known Implementing Classes:
    HazelcastReceiver, JedisReceiver, MulticastReceiver, RabbitMQReceiver, TribesReceiver

      public interface Receiver
      extends Closeable

  Implementations are able to receive `Event`s from multiple `Sender`s.
  Author:
    Matthias Müller
  See Also:
    `Event`, `Sender`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default void` | `close()` Closes the receiver, in particular blocking I/O resources need to be closed here.
    `Receiver` | `configure(Serializer eventDeserializer)` Configures the receiver
    `Sender` | `createSender()` Creates and returns a `Sender` capable of sending `Event`s that can be received by this type of receiver.
    `void` | `registerHandler(EventHandler<?> handler)` Registers a new `EventHandler`
    `void` | `runWith(ExecutorService executorService)` Since a receiver runs as a thread, the given `ExecutorService` should be used to run this thread.
    `void` | `setDefaultHandler(EventHandler<?> defaultHandler)` Sets the default `EventHandler`, used when no other handler is registered for a certain event type

- - ### Method Detail

    - #### registerHandler

          void registerHandler(EventHandler<?> handler)

      Registers a new `EventHandler`
      Parameters:
        `handler` - the `EventHandler` to register

    - #### setDefaultHandler

          void setDefaultHandler(EventHandler<?> defaultHandler)

      Sets the default `EventHandler`, used when no other handler is registered for a certain event type
      Parameters:
        `defaultHandler` - the default `EventHandler` to use

    - #### configure

          Receiver configure(Serializer eventDeserializer)

      Configures the receiver
      Parameters:
        `eventDeserializer` - the `Serializer` for this receiver
      Returns:
        the configured receiver

    - #### createSender

          Sender createSender()

      Creates and returns a `Sender` capable of sending `Event`s that can be received by this type of receiver.
      Returns:
        the `Sender`

    - #### runWith

          void runWith(ExecutorService executorService)

      Since a receiver runs as a thread, the given `ExecutorService` should be used to run this thread.
      Parameters:
        `executorService` - the `ExecutorService` to run this receiver with

    - #### close

          default void close()
                      throws IOException

      Closes the receiver, in particular blocking I/O resources need to be closed here.
      Specified by:
        `close` in interface `AutoCloseable`
      Specified by:
        `close` in interface `Closeable`
      Throws:
        `IOException`

Copyright © 2011–2023 aiticon GmbH. All rights reserved.