Connecting to the Target System

To enable your adapter to connect to the target system, configure the target system URL, username, and password or secret. You can implement a check for target system availability, and retry the connection a configurable number of times in case of connection failure.

Decrypting the Target System Password

The targetSystem node of your target-extension.xml file contains the following configured items:
  • target system URL
  • user name
  • password (or equivalent concepts such as API ID and secret)
<targetSystem>
	<name>HybrisApparelCoreInstallation</name>
	<type>HybrisCore</type>
	<exportURL>${datahub.extension.exportURL}</exportURL>
	<userName>${datahub.extension.userName}</userName>
	<password>${datahub.extension.password}</password>
...

The actual implementation of the connection depends on the target system. However, as the password or secret is encrypted by default in the Data Hub database, it is necessary to utilize an AttributeEncryptionStrategy to decrypt the password. For more details on encryption in Data Hub, see Attribute Encryption. The following code snippet demonstrates how you can implement password decryption.

com.hybris.datahub.security.AttributeEncryptionStrategy encryptionStrategy;
[...]
 
String password = encryptionStrategy.decrypt(target.getPassword());

Checking Target System Availability

The 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. To use the isTargetSystemAvailable method, provide an implementation specific to your target system. You can then use the returned value to decide whether to proceed with processing target items, or set the publication to FAILURE, without further processing. For more information on this topic, see Checking Target System Availability.

What's next?

With the means to successfully establish a connection to your target system in place, it's time to implement the details of your publish method. The following topic walks you through using this key method.