public class HazelcastReceiver extends Object implements Receiver, com.hazelcast.topic.MessageListener<byte[]>
Receiver that uses a reliable
topic for sending Events.
Following platform properties are supported (default value in brackets):
hazelcastTopicName (appng-messaging): Name of the topicHazelcastInstance.getReliableTopic(String)| Modifier and Type | Field and Description |
|---|---|
protected com.hazelcast.core.HazelcastInstance |
instance |
protected Serializer |
serializer |
| Constructor and Description |
|---|
HazelcastReceiver() |
| 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()
|
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 |
protected com.hazelcast.core.HazelcastInstance instance
protected Serializer serializer
public Receiver configure(Serializer serializer)
Receiverconfigure in interface Receiverserializer - the Serializer for this receiverpublic Sender createSender()
ReceiverSender capable of sending Events that can be received by this type of
receiver.createSender in interface ReceiverSenderpublic void runWith(ExecutorService executorService)
ReceiverExecutorService should be used to run this thread.runWith in interface ReceiverexecutorService - the ExecutorService to run this receiver withpublic void close()
throws IOException
Receiverclose in interface Closeableclose in interface AutoCloseableclose in interface ReceiverIOExceptionpublic void onMessage(com.hazelcast.topic.Message<byte[]> message)
onMessage in interface com.hazelcast.topic.MessageListener<byte[]>protected org.slf4j.Logger logger()
public void registerHandler(EventHandler<?> handler)
ReceiverEventHandlerregisterHandler in interface Receiverhandler - the EventHandler to registerpublic void setDefaultHandler(EventHandler<?> defaultHandler)
ReceiverEventHandler, used when no other handler is registered for a certain event typesetDefaultHandler in interface ReceiverdefaultHandler - the default EventHandler to useprotected com.hazelcast.topic.ITopic<byte[]> getTopic()
protected String getTopicName()
Copyright © 2011–2020 aiticon GmbH. All rights reserved.