Modifier and Type | Field and Description |
---|---|
static String |
APPNG_NODE_ID
Name of a system property used to identify the node
|
Constructor and Description |
---|
Messaging() |
Modifier and Type | Method and Description |
---|---|
static Sender |
createMessageSender(Environment env,
ExecutorService executor)
|
static Sender |
createMessageSender(Environment env,
ExecutorService executor,
String nodeId,
EventHandler<? extends Event> defaultHandler,
Iterable<EventHandler<? extends Event>> handlers)
|
static Sender |
getMessageSender(Environment env)
Retrieves the previously created
Sender from the Environment . |
static String |
getNodeId(Environment env)
Determines the node id for this node.
|
protected static Properties |
getPlatformConfig(Environment env) |
static boolean |
isEnabled(Environment env) |
static void |
shutdown(Environment env)
Shuts down the messaging system, i.e.
|
public static final String APPNG_NODE_ID
public static Sender getMessageSender(Environment env)
Sender
from the Environment
.env
- the Environment
to useSender
, if availablecreateMessageSender(Environment, ExecutorService)
,
createMessageSender(Environment, ExecutorService, String, EventHandler, Iterable)
public static Sender createMessageSender(Environment env, ExecutorService executor)
Sender
and a corresponding Receiver
. The class name for the receiver is
taken from the platform property "messagingReceiver". Uses the system
property "appng.node.id" to retrieve the node id for the Serializer
. If this property is absent,
the local host name is used and the property is set.env
- the Environment
to useexecutor
- the ExecutorService
to run the Receiver
withSender
(if the platform property
"messagingEnabled" is true
null
if messaging is disabled or an error occurred while creating the sender
public static String getNodeId(Environment env)
java.net.InetAddress.getLocalHost().getHostName()
}).env
- the Environment
to useprotected static Properties getPlatformConfig(Environment env)
public static Sender createMessageSender(Environment env, ExecutorService executor, String nodeId, EventHandler<? extends Event> defaultHandler, Iterable<EventHandler<? extends Event>> handlers)
Sender
and a corresponding Receiver
. The class name for the receiver is
taken from the platform property "messagingReceiver".env
- the Environment
to useexecutor
- the ExecutorService
to run the Receiver
withnodeId
- the node id for the Serializer
defaultHandler
- the default EventHandler
for the Receiver
(may be null
)handlers
- a list of EventHandler
s to be registered at the Receiver
Sender
(if the platform property
"messagingEnabled" is true
null
if messaging is disabled or an error occurred while creating the sender
public static boolean isEnabled(Environment env)
public static void shutdown(Environment env)
Closeable.close()
for the Sender
and the
Receiver
(in case the latter do implement Closeable
)env
- then Environment
to useCopyright © 2011–2020 aiticon GmbH. All rights reserved.