Load
Load is the most straightforward of the three main Data Hub processes. As such, there are not many modifications you can make to the load process. However, there are a few things you can do to make it more efficient with specific kinds of data and with specific load actions.
Data Loading Architecture
The Data Hub Spring Integration mechanism enables data loading of raw (fragmented) data as key/value pairs. Each fragment is represented as a Map<String, String> where the key represents the name of the raw attribute. The second element is the value corresponding to the key. In the following snippet from a rawExtension.xml file, the raw attribute <name>city</name> has city as the key. When the source data is prepared for loading, the key city is matched with the correct source data; a city name.
<rawItems>
<item>
<type>RawCustomer</type>
<description>Raw representation of the customer</description>
<attributes>
<attribute>
<name>name</name>
</attribute>
<attribute>
<name>street</name>
</attribute>
<attribute>
<name>city</name>
</attribute>
</attributes>
</item>
</rawItems>
If there is no value (for example, the value is null), the attribute is ignored. Any string, including the empty string, is supported as an attribute value. When an attribute value is set to an empty string, this value means that the attribute has been cleared. There is a difference between empty strings and null values in raw items. Null is treated like an ‘ignore’. An empty string, however, is treated as an explicit value, so the empty string overrides any previous value.
- The payload of the RawFragmentMessageInputChannel can accept a List<Map<String, String>> instance as a parameter.
- The payload of the RawFragmentDataInputChannel can accept a List<RawFragmentData>. The type of the payload is defined either in the header of the Message, such as RawFragmentMessageInputChannel, or as a RawFragment <Data.type> variable, such as RawFragmentDataInputChannel.
The Event Sample Extension
The Event Sample extension creates a new DataHubFeed and poolon startup. You can send source data through this feed to the pool. Then other parts of this extension trigger events that immediately compose and publish the items.
The extension contains the following files:
| File Name | Description |
|---|---|
| event-sample-datahub-extension.xml | The file is a stub. You provide your own extension definition. |
| event-sample-datahub-extension-spring.xml | The file defines a bean for each of the listener jars. |
| FeedCreationListener.java | The file provides a template where you can define the name of your feed and your pool. You then point to the feed and pool from your data loading extension. |
| DataLoadedEventListener.java | This listener is waiting for the DataLoadingCompletedEvent.
|
| CompositionCompletedEventListener.java | This listener is waiting for the CompositionCompletedEvent.
|
| PublicationCompletedEventListener.java | The CompositionCompletedEventListener.java file triggers the InitiatePublicationEvent event to publish to a single target. If another target system has been named, the names PublicationCompletedEventListener.java file listens for the PublicationCompletedEvent and triggers another InitiatePublicationEvent event.
Since Data Hub can publish to multiple target systems from the same publication action, this listener is somewhat superfluous. |
| SampleEventDrivenPoolConstants.java | This file is a stub. You provide your own list of constants. |
You can download the event-sample extension file from the Solution Book.
sapidocintegration Data Hub Extension
The sapidocintegration Data Hub extension provides a Spring integration end point to receive IDocs from SAP systems. It also provides the Spring integration flow definition to route incoming IDocs to raw models in Data Hub. Furthermore, the extension provides data models for SAP configuration that are used by other SAP Data Hub extensions.
IDOCMappingService contains an implementation of the map method required by the service-activator to transform an IDoc XML file into a list of RawFragmentData.
The transformation process starts at the IDoc element. Each segment and attribute name is concatenated using the "-" separator to create the raw item attribute name.
- rawAttributesSetRepeated: Default empty set. Attribute names specified here must be searched in the resulting list of RawFragmentData to ensure that the value is available in all RawFragmentData. Having the value available in all RawFragmentData is useful when the key attribute is available only in a subsegment but is also needed in sibling segments.
- rawFragmentDataExtensionSource: Default sapidocintegration. Specify the RawFragmentData.setExtensionSource (extensionSource string).
- rawFragmentDataFeedName: Default DEFAULT_FEED. Specify the RawFragmentData.setDataFeedName (dataFeedName string).
- rawFragmentDataType: Default Raw + (EDI_DC40-MESTYP). Specify the RawFragmentData.setType (type string).
Limiting the Size of Loading Datasets
Send data to Data Hub in smaller increments and allow it to be processed before sending the next set of items. Sending volumes of items that are too large can result in Data Hub slowing down drastically and appearing to 'freeze' and not complete actions. For example, break a 10 million item dataset into smaller chunks. The size of these chunks depends on your specific Data Hub installation.