Tracing Raw Items

Data Hub supports unique identifiers that allow you to trace raw items across the lifecycle of the item.

The Batch ID

Data Hub recognizes three additional reserved data fields when loading raw items. These fields enable the identification of loaded items at a more granular level than is possible with the data loading action alone. Data Hub uses the data in these fields to create a pipe-delimited batch ID. The batch ID provides traceability of items specific to a single source throughout the Data Hub workflow. The three reserved fields are:

  • dh_batchid
  • dh_sourceid
  • dh_type

You can include these items as additional data fields in any data set that you load into Data Hub. For example, you could use dh_batch to identify the documents being loaded, dh_source to identify the source system, and dh_type to identify the data type.

Following is an example of these additional fields in a CSV file.

source,isoCode,baseName,baseDescription,ean,manufacturerName,dh_batch,dh_source,dh_type
118313,en,Star SS,baseDescription_96,NULL,,batch123,ERP,MATMAS

These fields can be any string value. The values you supply are based on business needs and your requirements for traceability. For an IDoc, you may typically specify: DOCNUM, SNDPRN, and IDOCTYP. For a CSV file, it may be something like: hybris order ID, hybris system ID, and order.

Data Hub concatenates the values from these three fields into a pipe delimited Batch ID for the purpose of monitoring and tracing. A batch ID that is generated from the preceding data takes the following form.

+----+-------------------+---------------------+
| id | dataloadingaction | batchid             |
+----+-------------------+---------------------+
|  1 |                 1 | batch123|ERP|MATMAS |
+----+-------------------+---------------------+

With a batch ID, you can easily determine the history and current state of any items loaded into Data Hub from a specific batch of items. For example, you may wish to identify the segments of a particular IDoc that loads as part of a collection of IDocs in a single batch. It is not possible to trace them by loading action alone, as only one loading action ID is assigned for all segments. But the batch ID allows you to trace each segment individually, based on the identifying values that you supply.

You do not supply the dh_batchId field, or you do not provide a value for the field. As a consequence, Data Hub populates the first portion of the Batch ID with the data loading action ID. In the following example, the data loading action ID is 1, and the dh_batchId field was not supplied.

1|ERP|MATMAS

If either of the other two fields are not supplied, Data Hub leaves the corresponding position in the batch ID without a value. In the following example, no raw item tracing data was provided.

1||

Batch ID is limited to 255 characters in length, and has no uniqueness constraint.

The Trace ID

The trace ID is a universally unique identifier (UUID) that is provided for every data loading action. Unlike data loading action IDs, however, the trace ID never gets duplicated, even after you restart and initialize Data Hub. Using the batch ID and trace ID together, you can track items across the entire history of your Data Hub installation.

Trace IDs have the following form:

+----+-------------------+---------------------+--------------------------------------+
| id | dataloadingaction | batchid             | traceid                              |
+----+-------------------+---------------------+--------------------------------------+
|  1 |                 1 | batch123|ERP|MATMAS | 5f3f3118-1411-3353-b658-4aa1c4e2aef3 |
+----+-------------------+---------------------+--------------------------------------+

A trace ID also represents a single instance of a batch. If you resend the identical batch of items, it receives a new trace ID. Data Hub persists the traceID to the database, together with each raw item. The trace ID is unique per data loading action, and persists as a String.

Batch IDs and Trace IDs in Events and Logging

When you enable item-level events for raw items, Data Hub includes the raw item batch ID, and trace ID, in all related event publications. If you also enable item-level logging, the IDs are recorded for each raw item in the logs, as follows:

2017-02-23 10:47:02,046 [INFO] [c.h.d.l.i.RawItemLoggingService] GLOBAL RawProduct id=1 delete=false isoCode=en action=1 traceId=5f3f3118-1411-3353-b658-4aa1c4e2aef3 batchId=batch123|ERP|MATMAS

For more information on enabling item level logging, see Logging Item Behavior.