Checking Target System Availability

The Data Hub AdapterService contains a method for checking whether a target system is available. Using this method, you can prevent Data Hub spending unnecessary time and resources processing items for a target system that is unreachable.

The default implementation of the isTargetSystemAvailable method always returns true:

default boolean isTargetSystemAvailable(TargetSystem targetSystem)
{
	return true;
}

There are two approaches to building a custom output adapter. You can inherit the default implementation from the interface or provide your own availability check specific to your target system. Use the returned value to determine whether to proceed with a publication. If the given target system is unreachable, you can skip TargetItem creation entirely.

In the event of an unreachable system, the TargetSystemPublication status can be set to FAILURE without any further processing inside Data Hub. A TargetSystemPublication status of FAILURE then sets the corresponding publicationAction status to FAILURE.

Target System Availability Retry

The PublicationActionService contains a retry functionality that is triggered when the isTargetSystemAvailable method returns false. The retry functionality pings the target system a configurable number of times, with an exponential lengthening of the wait time before each subsequent try. You can configure the maximum number of attempts, or maximum time to wait before concluding the target system is unavailable. The ability to retry a connection is ideal in situations where intermittent network issues may be an issue.

The retry is configured with the following default properties:

#The maximum number of attempts
datahub.retry.max.attempts=5
#The initial sleep interval in milliseconds
datahub.retry.initial.interval.millis=500
#The value to increment the exponential seed with for each retry attempt.
#Hint: do not use values much in excess of 2.0 (or the backoff gets very long, very fast).
datahub.retry.multiplier=2
#The maximum value of the backoff period in milliseconds.
datahub.retry.max.interval.millis=256000

You may override any of these properties in your own local.properties file. The default setting for datahub.retry.max.attempts is -1, which means do not stop trying to connect. Setting a datahub.retry.max.attempts value of 0 disables the retry functionality.

For each failed ping attempt, the method throws an illegalStateException, with the log output Ping failed. After either the maximum retry interval, or maximum number of attempts, with no success, the log output appears as follows:

The target system <TargetSystemName> at <TargetSystemURL> is unavailable for target system publication id <PublicationId> and pool <PoolName>: <Message>.