Chapter 5. Grid configuration 91
</backingMapPluginCollections>
</objectGridConfig>
5.3.2 The ObjectGridEventListener plug-in
An ObjectGridEventListener plug-in provides WebSphere eXtreme Scale ObjectGrid shard
and transaction life-cycle events. These events include ObjectGrid shard initialization,
destroying, activation and deactivation, and transaction beginning and ending. WebSphere
eXtreme Scale provides two built-in implementations of the ObjectGridEventListener plug-in:
򐂰 JMSObjectGridListener
򐂰 TranPropListener
It is also possible to implement a custom version of this plug-in.
The JMSObjectGridEventListener plug-in
The JMSObjectGridEventListener is a Java Message Service (JMS) implementation of the
ObjectGridEventListener interface. You can use it for two purposes:
򐂰 Near cache invalidation
򐂰 Peer-to-peer replication
Near cache invalidation enables WebSphere eXtreme Scale client applications to keep their
near cache content synchronized with each other or with the content of the WebSphere
eXtreme Scale server cache when another client is updating the server cache. You can use
peer-to-peer replication to maintain the same data between two separate distributed or local
WebSphere eXtreme Scale servers.
Using the built-in JMSObjectGridEventListener plug-in is the preferred method when a client
application needs to be notified of updates that occur in the server grid. Notifications are
processed in the onMessage() method implementation. This method gives the client the
opportunity to update its near cache. It also requires you to configure JMS and Java Naming
and Directory Interface (JNDI) information. If you are running WebSphere Application Server,
you can use its default messaging provider. Otherwise, you need a JMS provider, such as
WebSphere MQ. Because of the asynchronous nature of JMS, notifications of updates in the
near cache occur after a certain delay.
To use near cache invalidation, you need to complete the following tasks:
1. Write a JMSObjectGridEventListener extension that implements the onMessage()
method. You can find an example of such an implementation in the WebSphere eXtreme
Scale Information Center:
http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.e
xtremescale.admin.doc/cxsjmsevntls.html
Peer-to-peer replication warning: Using the JMSObjectGridEventListener plug-in for
peer-to-peer replication is no longer recognized as a preferred practice. The plug-in can be
difficult to set up and does not scale well. The preferred practice for peer-to-peer
replication is to use the WebSphere eXtreme Scale multi-master replication feature.
Important: The built-in JMSObjectGridEventListener does nothing. It is designed to be
extended, and the user is in charge of writing an invalidation mechanism in the
onMessage() method.
92 WebSphere eXtreme Scale Best Practices for Operation and Management
2. Configure the JMS topic and the related JNDI names. We do not explain this task here,
but, remember, when designing the JMS topic connection factory, that each container
server in a publisher role creates one connection for each partition during the
JMSObjectGridEventListener initialization. You must size the connection pool size
according to your topology.
In addition to these tasks, you need to configure the JMSObjectGridEventListener plug-in by
adding the following elements in the ObjectGrid descriptor XML file:
򐂰 In the objectGrid element, add a bean element with the following settings:
–The ID attribute is set to JMSObjectGridEventlistener.
–The className attribute is set with the class name of your
JMSObjectGridEventListener extensions.
򐂰 In the JMSObjectGridEventListener bean element, add the following required property
elements:
A property element with the following settings:
•The name attribute is set to invalidationModel.
•The type attribute is set to java.lang.String.
•The value attribute is set to NONE_INVALIDATION_MODEL, CLIENT_SERVER_MODEL, or
CLIENT_AS_DUAL_ROLES_MODEL.
A property element with the following settings:
•The name attribute is set to invalidationStrategy.
•The type attribute is set to java.lang.String.
•The value attribute is set to INVALIDATE, INVALIDATE_CONDITIONAL, PUSH,
PUSH_CONDITIONAL, PUSH_INCLUDED, or PUSH_INCLUDED_CONDITIONAL.
A property element with the following settings:
•The name attribute is set to jms_topicConnectionFactoryJndiName.
•The type attribute is set to java.lang.String.
•The value attribute is set to the JNDI name of the Topic connection factory.
A property element with the following settings:
•The name attribute is set to jms_topicJndiName.
•The type attribute is set to java.lang.String.
•The value attribute is set to the JNDI name of the Topic for publishing or receiving
notifications.
A property element with the following settings:
•The name attribute is set to jms_topicName.
•The type attribute is set to java.lang.String.
•The value attribute is set to the name of the Topic for publishing or receiving
notifications.
Optionally, If security is enabled to connect to the topic, you can add the following property
elements:
򐂰 A property element with the following settings:
–The name attribute is set to jms_userid.
–The type attribute is set to java.lang.String.

Get WebSphere eXtreme Scale Best Practices for Operation and Management now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.