public class RabbitMQReceiver extends RabbitMQBase implements Receiver
Receiver
to use a RabbitMQ message broker. Following platform properties are
needed (default value in brackets):
eventSerializer, exchange, EXCHANGE_TYPE_FANOUT, host, password, port, user
Constructor and Description |
---|
RabbitMQReceiver() |
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 eventSerializer)
Configures the receiver
|
RabbitMQSender |
createSender()
|
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 |
getConnectionConfig, initialize
public Receiver configure(Serializer eventSerializer)
Receiver
configure
in interface Receiver
eventSerializer
- the Serializer
for this receiverpublic RabbitMQSender createSender()
Receiver
Sender
capable of sending Event
s that can be received by this type of
receiver.createSender
in interface Receiver
Sender
public void runWith(ExecutorService executorService)
Receiver
ExecutorService
should be used to run this thread.runWith
in interface Receiver
executorService
- the ExecutorService
to run this receiver withpublic void registerHandler(EventHandler<?> handler)
Receiver
EventHandler
registerHandler
in interface Receiver
handler
- the EventHandler
to registerpublic void setDefaultHandler(EventHandler<?> defaultHandler)
Receiver
EventHandler
, used when no other handler is registered for a certain event typesetDefaultHandler
in interface Receiver
defaultHandler
- the default EventHandler
to usepublic void close() throws IOException
Receiver
close
in interface Closeable
close
in interface AutoCloseable
close
in interface Receiver
IOException
Copyright © 2011–2017 aiticon GmbH. All rights reserved.