import com.opencloud.rhino.facilities.message.MessageFacility;
import javax.slee.resource.ConfigProperties;
public class MyResourceAdapter implements ResourceAdaptor {
public void raConfigure(ConfigProperties configProperties) {
...
MessageFacility messageFacility = null;
ConfigProperties.Property property = configProperties.getProperty(MessageFacility.CONFIG_PROPERTY_NAME);
if (property != null) {
messageFacility = (MessageFacility) property.getValue();
}
...
}
...
}
Interface MessageFacility
-
public interface MessageFacility
Rhino extension facility which allows a resource adaptor entity to send messages between Rhino nodes in the same cluster or pool.
The
MessageFacility
is made available to a resource adaptor entity via its configuration properties, under theCONFIG_PROPERTY_NAME
key.An example of how to access the message facility from a resource adaptor is given below:
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONFIG_PROPERTY_NAME
Config property key string defining the location where an instance of theMessageFacility
interface may be found by a resource adaptor entity in theConfigProperties
given to it.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addMessageListener(MessageListener listener)
Add a message listener.void
addMessageListener(MessageListenerV2 listener)
Add a message listener.int
getLocalNodeID()
Get the node ID of the current Rhino node.MessageSender
getMessageSender()
Get a MessageSender for sending messages to other Rhino nodes within the context of the same resource adaptor entity.String
getRhinoNodeID()
Get the node ID of the current Rhino node.void
removeMessageListener(MessageListener listener)
Remove a message listener.void
removeMessageListener(MessageListenerV2 listener)
Remove a message listener.void
setRequestListener(RequestListener listener)
Set a listener to respond to incoming requests.void
setRequestListener(RequestListenerV2 listener)
Set a listener to respond to incoming requests.
-
-
-
Field Detail
-
CONFIG_PROPERTY_NAME
static final String CONFIG_PROPERTY_NAME
Config property key string defining the location where an instance of the
MessageFacility
interface may be found by a resource adaptor entity in theConfigProperties
given to it.- See Also:
- Constant Field Values
-
-
Method Detail
-
getLocalNodeID
int getLocalNodeID()
Get the node ID of the current Rhino node.
This method returns the node ID in the legacy numeric form. For new work, it is recommended to use
getRhinoNodeID()
instead.- Returns:
- the local node ID.
-
getRhinoNodeID
String getRhinoNodeID()
Get the node ID of the current Rhino node. This method returns the node ID in string form.
- Returns:
- the local node ID.
- Since:
- Rhino 3.2
-
getMessageSender
MessageSender getMessageSender()
Get a MessageSender for sending messages to other Rhino nodes within the context of the same resource adaptor entity.
Typically this method would be called in
raConfigure(ConfigProperties)
orraActive()
.
-
addMessageListener
void addMessageListener(MessageListener listener)
Add a message listener. If the listener has already been added, this method has no effect.
Typically this method would be called in
raConfigure(ConfigProperties)
orraActive()
.For new work, it is recommended to use
addMessageListener(MessageListenerV2)
instead of this method, whereMessageListenerV2
uses string node IDs instead of numeric.- Parameters:
listener
- the message listener to add.
-
removeMessageListener
void removeMessageListener(MessageListener listener)
Remove a message listener. If the listener was not currently registered, this method has no effect.
This method would typically be called in
raUnconfigure()
,raStopping()
, orraInactive()
.- Parameters:
listener
- the message listener to remove.
-
setRequestListener
void setRequestListener(RequestListener listener)
Set a listener to respond to incoming requests.
Typically this method would be called in
raConfigure(ConfigProperties)
.At most one request listener (regardless of type) may be set in the message facility at any one time. Calling this method will replace any existing request listener with the new listener specified.
For new work, it is recommended to use
setRequestListener(RequestListenerV2)
instead of this method, whereRequestListenerV2
uses string node IDs instead of numeric.- Parameters:
listener
- the request listener. May benull
to clear any existing listener reference.- Since:
- Rhino 2.3.0
-
addMessageListener
void addMessageListener(MessageListenerV2 listener)
Add a message listener. If the listener has already been added, this method has no effect.
Typically this method would be called in
raConfigure(ConfigProperties)
orraActive()
.- Parameters:
listener
- the message listener to add.- Since:
- Rhino 3.2
-
removeMessageListener
void removeMessageListener(MessageListenerV2 listener)
Remove a message listener. If the listener was not currently registered, this method has no effect.
This method would typically be called in
raUnconfigure()
,raStopping()
, orraInactive()
.- Parameters:
listener
- the message listener to remove.- Since:
- Rhino 3.2
-
setRequestListener
void setRequestListener(RequestListenerV2 listener)
Set a listener to respond to incoming requests.
Typically this method would be called in
raConfigure(ConfigProperties)
.At most one request listener (regardless of type) may be set in the message facility at any one time. Calling this method will replace any existing request listener with the new listener specified.
- Parameters:
listener
- the request listener. May benull
to clear any existing listener reference.- Since:
- Rhino 3.2
-
-