Dynamic Publication
In-memory processing dramatically speeds up processing by significantly reducing database access. Optimized in-memory processing continues to provide Data Hub durability guarantees, which ensures that these items are processed and preserved in the case of crash or restart.
The in-memory process uses the datahub.max.composition.action.size property to create processing batches. These batches stay in memory and automatically publish. Data Hub does not persist target items when publication is run in memory. If you want to save a copy of your target items to the database, do not use this technique.
To activate publication in memory, set the following two properties in your local.properties file:
- target.system.publication.configuration - In the dynamic publication process, there is no longer a pause between composition and publication. You specify the pool the data is coming from and the target system or systems the canonical items are going to. For example:
target.system.publication.configuration=GLOBAL.HybrisApparelCoreInstallation,autoPublishPool.HybrisApparelCoreInstallation
When reading the values on the right side of the equals sign above, GLOBAL is a pool name as is autoPublishPool. The HybrisApparelCoreInstallation is the target system to which the canonical items in the pool are published. - datahub.config.mode - This property is used to activate in-memory publication. Activate in-memory publication by setting this property to IN_MEMORY in your local.properties file. If the datahub.config.mode=STANDARD, or it is not set, the publication process runs in standard mode. It does not run in memory.
Data Flow
When publication in memory is active, the flow of canonical items is somewhat different. There is a property, datahub.max.composition.action.size, that is used to determine the maximum batch size for each composition action. Please note that this property only defines the action size, not the size of the entire composition job. The job may be composed of multiple composition actions. When a composition action reaches its max size, the following things happen:
- Canonical items are written to database and moved into memory for publication
- Canonical items that are moved into memory are automatically published
- The target system tells the publication engine that publication is complete
- All canonical item statuses are updated
- The publication action status is updated
- Then the publication engine grabs the next batch of canonical items
This back and forth interaction continues until all canonical items have been published. At that time, a final publication job runs where all canonical items that failed in previous publication actions are gathered and published.
Things you should note:
- the composition process is the same
- the publication process is the same
- all status information is maintained and persisted
- the data flow is somewhat different
- canonical items are still persisted to the Data Hub database
- a copy of the canonical items is now loaded into the publication cache for use by the publication process
- target items are written to a target item cache but they are not persisted
- handlers are supported seamlessly
- custom target adapters require no modification
Data Persistence
Canonical Items
In the standard publication process, Data Hub updates all related statuses once a publication job is completed. In the dynamic publication process, statuses are updated once publication from memory completes, and before the publication process goes back to composition for more items. Data Hub updates both the canonical item statuses and the publication action status. It then begins the composition process again, looking for more data. The canonical item values that have been persisted remain completely current.
Target Items
In the standard process, when the publication process creates the target item, the target item is persisted to the Data Hub database. In the dynamic publication process, the newly created target items are held in memory. They are then passed to the target adapter one page at a time. Once the target adapter has processed all the target items, it reports that publication is complete. At this point, the publication process updates the canonical item statuses and the publication action status. Then the publication process turns to the composition process for more data. Note: target items do not get persisted when publication is done in memory.
Auto Publication with the sapcoreconfiguration Extension
The sapcoreconfiguration Data Hub extension provides its own auto-publication feature. When deploying Data Hub as part of an SAP ERP integration, and using the Data Hub dynamic publication feature, disable the auto-publication feature of sapcoreconfiguration. To disable it, remove any configured sapcoreconfiguration auto-publish target systems by pool. For more information, see https://help.sap.com/viewer/0af2145522f64abd9d7d00bc69e4745a/2005/en-US/8c47f518866910149542c93b20dbd0e2.html.