77 WEM Framework: Buffering

Asset create, update, and delete operations are much slower than the read operation. Sometimes, it is acceptable to delay these operations to occur at a future time with the guarantee of eventual consistency. That is, if a delayed (buffered) operation was performed, it is guaranteed that the WebCenter Sites platform will receive the change at some finite, undetermined period of time. Although buffering operations are extremely fast, they do not speed up the total time that is needed to create, update, and delete assets in the platform.

This chapter contains the following sections:

77.1 Architecture

The current implementation of buffering subsystem relies on Java Messaging Service (JMS) technology.

Description of jmsarchitecture.gif follows
Description of the illustration jmsarchitecture.gif

Buffering consists of the following components:

  • Buffering Producer, which produces messages and puts them into the Messaging Queue (MQ).

  • Buffering Consumer, which picks messages from MQ and persists them in the platform.

The buffering producer can be used on both WebCenter Sites and Remote Satellite Server, where the asset REST service <BaseURI>/sites/<sitename>/types/<assettype>/assets/<id> is available. When used on Remote Satellite Server, the buffering producer does not communicate with WebCenter Sites, which ensures linear scalability of the entire system.

Note:

The buffering consumer is available only on WebCenter Sites. We recommend enabling the buffering consumer only on the primary cluster member. Enabling on multiple cluster members cannot guarantee that the sequence of CRUD operations will be preserved.

77.2 Using Buffering

  1. Install the JMS provider if one is not already available. (For supported providers, see the Oracle Fusion Middleware WebCenter Sites Certification Matrix available from the Oracle Technology Network at http://otn.oracle.com.

  2. Configure BufferingConfig.xml on WebCenter Sites and optionally on Remote Satellite Server.

    id="bufferingManager" class=
      "com.fatwire.cs.core.buffering.jms.JmsBufferingManager"
    

    Table 77-1 Properties in BufferingConfig.xml

    Property name Description

    jmsConnectionFactory

    Required. Instance of javax.jms.ConnectionFactory

    jmsDestination

    Required. Instance of javax.jms.Destination

    messageConsumers

    List of com.fatwire.cs.core.buffering.IMessageConsumer implementations.


    Note:

    When you configure BufferConfig.xml, add activemq-all.jar to the WebCenter Sites web application's classpath (for example, WEB-INF/lib).

  3. Specify buffer=true when invoking the REST asset service <BaseURI>/sites/ <sitename>/types/<assettype>/assets/<id>.

    Note:

    Buffering does not return the result of PUT and POST operations in the response. Instead, an empty payload is sent. Developers should be aware of this behavior when coding the client application.

The default BufferingConfig.xml file, provided with WebCenter Sites, contains the sample configuration for Apache ActiveMQ. The BufferingConfig.xml file is similar for both WebCenter Sites and Remote Satellite Server, except that the list of message consumers for Remote Satellite Server is empty.