public class JedisReceiver extends JedisBase implements Receiver, Runnable
Receiver to use a redis database with its build-in publish/subscribe function
as message broker. Following platform properties are needed (default value in brackets):
redisMessagingHost (localhost): Host of the redis serverredisMessagingPort (6379): Port of the redis serverredisMessagingPassword (): Password of the redis serverredisMessagingTimeout (): Timeout is optional. If not defined, Redis default is usedredisMessagingChannel (appng-messaging): Channel where all cluster nodes should publish and subscribe. Be
aware that this name must be different among different clusters using the same Redis serverchannel, eventSerializer, host, password, port, REDIS_MESSAGING_CHANNEL, REDIS_MESSAGING_HOST, REDIS_MESSAGING_PASSWORD, REDIS_MESSAGING_PORT, REDIS_MESSAGING_TIMEOUT, timeout| Constructor and Description |
|---|
JedisReceiver() |
| 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 eventDeserializer)
Configures the receiver
|
Sender |
createSender()
|
String |
getHost() |
int |
getPort() |
int |
getTimeout() |
void |
registerHandler(EventHandler<?> handler)
Registers a new
EventHandler |
void |
run() |
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 |
void |
setHost(String host) |
void |
setPort(int port) |
void |
setTimeout(int timeout) |
getJedis, initializepublic Receiver configure(Serializer eventDeserializer)
Receiverconfigure in interface ReceivereventDeserializer - 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 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 usepublic String getHost()
public void setHost(String host)
host - the host to setpublic int getPort()
public void setPort(int port)
port - the port to setpublic int getTimeout()
public void setTimeout(int timeout)
timeout - the timeout to setpublic void close()
throws IOException
Receiverclose in interface Closeableclose in interface AutoCloseableclose in interface ReceiverIOExceptionCopyright © 2011–2021 aiticon GmbH. All rights reserved.