org.appng.core.controller.messaging

## Class RabbitMQReceiver

- java.lang.Object
- - org.appng.core.controller.messaging.RabbitMQBase
  - - org.appng.core.controller.messaging.RabbitMQReceiver

- All Implemented Interfaces:
    Closeable, AutoCloseable, Receiver

      public class RabbitMQReceiver
      extends RabbitMQBase
      implements Receiver

  Message receiver implementing `Receiver` to use a RabbitMQ message broker. Following platform properties are needed (default value in brackets):
  - `rabbitMQAdresses` (localhost:5672): A comma separated list of <host>:<port> for RabbitMQ server(s)
  - `rabbitMQUser` (guest): Username
  - `rabbitMQPassword` (guest): Password
  - `rabbitMQExchange` (appng-messaging): Name of the exchange where the receiver binds its messaging queue on. Be aware that this name must be different among different clusters using the same RabbitMQ server
  - `rabbitMQAutoDeleteQueue` (true): If the queue to create should be marked as autodelete.
  - `rabbitMQDurableQueue` (false): If the queue to create should be marked as durable.
  - `rabbitMQExclusiveQueue` (true): If the queue to create should be marked as exclusive.
  Author:
    Claus Stümke, aiticon GmbH, 2015, Matthias Müller

- - ### Field Summary

    - ### Fields inherited from class org.appng.core.controller.messaging.RabbitMQBase

      `addresses, channel, connection, eventSerializer, exchange, factory, password, RABBIT_MQ_ADRESSES, RABBIT_MQ_EXCHANGE, RABBIT_MQ_PASSWORD, RABBIT_MQ_USER, user`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RabbitMQReceiver()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Receiver` | `configure(Serializer eventSerializer)` Configures the receiver
    `RabbitMQSender` | `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

    - ### Methods inherited from class org.appng.core.controller.messaging.RabbitMQBase

      `close, initialize`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.appng.api.messaging.Receiver

      `close`

- - ### Constructor Detail

    - #### RabbitMQReceiver

          public RabbitMQReceiver()

  - ### Method Detail

    - #### configure

          public Receiver configure(Serializer eventSerializer)

      Description copied from interface: `Receiver`
      Configures the receiver
      Specified by:
        `configure` in interface `Receiver`
      Parameters:
        `eventSerializer` - the `Serializer` for this receiver
      Returns:
        the configured receiver

    - #### createSender

          public RabbitMQSender createSender()

      Description copied from interface: `Receiver`
      Creates and returns a `Sender` capable of sending `Event`s that can be received by this type of receiver.
      Specified by:
        `createSender` in interface `Receiver`
      Returns:
        the `Sender`

    - #### runWith

          public void runWith(ExecutorService executorService)

      Description copied from interface: `Receiver`
      Since a receiver runs as a thread, the given `ExecutorService` should be used to run this thread.
      Specified by:
        `runWith` in interface `Receiver`
      Parameters:
        `executorService` - the `ExecutorService` to run this receiver with

    - #### registerHandler

          public void registerHandler(EventHandler<?> handler)

      Description copied from interface: `Receiver`
      Registers a new `EventHandler`
      Specified by:
        `registerHandler` in interface `Receiver`
      Parameters:
        `handler` - the `EventHandler` to register

    - #### setDefaultHandler

          public void setDefaultHandler(EventHandler<?> defaultHandler)

      Description copied from interface: `Receiver`
      Sets the default `EventHandler`, used when no other handler is registered for a certain event type
      Specified by:
        `setDefaultHandler` in interface `Receiver`
      Parameters:
        `defaultHandler` - the default `EventHandler` to use

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