org.appng.core.controller.messaging

## Class HazelcastReceiver

- java.lang.Object
- - org.appng.core.controller.messaging.HazelcastReceiver

- All Implemented Interfaces:
    com.hazelcast.topic.MessageListener<byte[]>, Closeable, AutoCloseable, EventListener, Receiver

      public class HazelcastReceiver
      extends Object
      implements Receiver, com.hazelcast.topic.MessageListener<byte[]>

  A `Receiver` that uses a reliable topic for sending `Event`s. Following platform properties are supported (default value in brackets):
  - `hazelcastTopicName` (appng-messaging): Name of the topic
  Author:
    Matthias Müller
  See Also:
    `HazelcastInstance.getReliableTopic(String)`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected com.hazelcast.core.HazelcastInstance` | `instance`
    `protected Serializer` | `serializer`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HazelcastReceiver()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Closes the receiver, in particular blocking I/O resources need to be closed here.
    `Receiver` | `configure(Serializer serializer)` Configures the receiver
    `Sender` | `createSender()` Creates and returns a `Sender` capable of sending `Event`s that can be received by this type of receiver.
    `protected com.hazelcast.topic.ITopic<byte[]>` | `getTopic()`
    `protected String` | `getTopicName()`
    `protected org.slf4j.Logger` | `logger()`
    `void` | `onMessage(com.hazelcast.topic.Message<byte[]> message)`
    `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 java.lang.Object

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

- - ### Field Detail

    - #### instance

          protected com.hazelcast.core.HazelcastInstance instance

    - #### serializer

          protected Serializer serializer

  - ### Constructor Detail

    - #### HazelcastReceiver

          public HazelcastReceiver()

  - ### Method Detail

    - #### configure

          public Receiver configure(Serializer serializer)

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

    - #### createSender

          public Sender 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

    - #### close

          public void close()
                     throws IOException

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

    - #### onMessage

          public void onMessage(com.hazelcast.topic.Message<byte[]> message)

      Specified by:
        `onMessage` in interface `com.hazelcast.topic.MessageListener<byte[]>`

    - #### logger

          protected org.slf4j.Logger logger()

    - #### 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

    - #### getTopic

          protected com.hazelcast.topic.ITopic<byte[]> getTopic()

    - #### getTopicName

          protected String getTopicName()

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