Tutorial: Using and Configuring Connection Retry

The Data Hub Adapter is an extension of SAP Commerce Cloud. When data is moving from Data Hub to SAP Commerce Cloud and there is an interruption, Data Hub Adapter attempts to reconnect to Data Hub. You control how this effort works.

Using the following properties, you control how Data Hub Adapter reacts to a broken connection with Data Hub:

Connection Retry Properties
Property Value Description
datahubadapter.retry.initial.interval.millis = 1000 The initial sleep interval in milliseconds.
datahubadapter.retry.multiplier = 2 The value to increment the exponential seed with for each retry attempt.
datahubadapter.retry.max.attempts = 5 The maximum number of attempts.
datahubadapter.retry.max.interval.millis = 256000 The maximum value of the wait time in milliseconds.

Set these properties in the local.properties of your SAP Commerce Cloud installation. Find the file in the <HYBRIS_HOME>/config/ directory.

Exercise: Test Data Hub Connection Retry

Context

In the following scenario, you break a connection between Data Hub and Data Hub Adapter while data is flowing.

Procedure

  1. Configure connection retry using the techniques described previously.
  2. Using methods you have already learned, load the base_unique_items_100K.csv data file. (See the Solution Book)
  3. Compose the data file.
  4. Ensure that SAP Commerce Cloud is properly configured to start Data Hub Adapter when SAP Commerce Cloud launches.
  5. Change the datahubadapter.retry.max.attempts property to 7.
  6. Start SAP Commerce Cloud.
    In the next step, you are going to publish the data file. While it is publishing, break the connection between Data Hub and Data Hub Adapter by shutting down Data Hub.
  7. Publish the data file.
  8. Wait until the Data Hub log reflects callback activity, then shut down Data Hub.
  9. Restart Data Hub immediately. Data Hub goes through its recovery process, and Data Hub Adapter should reestablish communications.
  10. Review the SAP Commerce Cloud log file found in <HYBRIS_HOME>/hybris/log/tomcat. The following entries appear in the latest console log.
    WARN  [hybrisHTTP1] [ImpexDataImportClient] Data Hub Server is unavailable.  The Data Hub Adapter tries again in 1 second for retry attempt 1 of 10.
    WARN  [hybrisHTTP1] [ImpexDataImportClient] java.net.ConnectException: Connection refused: connect
    WARN  [hybrisHTTP1] [ImpexDataImportClient] Data Hub Server is unavailable.  The Data Hub Adapter tries again in 2 seconds for retry attempt 2 of 10.
    WARN  [hybrisHTTP1] [ImpexDataImportClient] java.net.ConnectException: Connection refused: connect
    WARN  [hybrisHTTP1] [ImpexDataImportClient] Data Hub Server is unavailable.  The Data Hub Adapter tries again in 4 seconds for retry attempt 3 of 10.
    WARN  [hybrisHTTP1] [ImpexDataImportClient] java.net.ConnectException: Connection refused: connect