Technical Articles
SAP Hybris Commerce to SAP Hybris Marketing Integration via the Expressway
Disclaimer: Expressway is a non-standard integration solution for sending master and transactional data from SAP Hybris Commerce to SAP Hybris Marketing (Cloud and on premise). The solution offers a point-to-point alternative to Data Hub, which is the middleware option that ships with SAP Hybris Commerce. In addition to supporting the same master and transactional data as Data Hub, Expressway can be useful for specific customer situations. For example, Expressway’s simple design can be leveraged when extensive field enhancements are required, or when expert knowledge of Data Hub is missing. Proficiency in SAP Hybris Commerce platform technology is the only prerequisite for understanding how to deploy, run, and enhance Expressway. As it is not officially supported, Expressway should only be considered as a template for building custom integration projects. Please note that Expressway can be co-deployed with the SAP Hybris Commerce Data Hub integration.
Expressway is a very lightweight integration between SAP Hybris Commerce and SAP Hybris Marketing. To deploy Expressway on your SAP Hybris Commerce server, all you have to do is add one extension to your localextensions.xml file, rebuild, and update your system. Once Expressway is deployed, you can immediately start sending master data and other marketing-relevant information to SAP Hybris Marketing. With Expressway, you can send customers, products, categories, reviews, abandoned carts, saved carts, and orders, all out-of-the-box. Moreover, Expressway can be deployed on older versions of SAP Hybris Commerce as far back as version 5.7.
Expressway uses the SAP Hybris Commerce job framework to initiate the replication of data to SAP Hybris Marketing. Each object type (e.g. product, customer, order, etc.) gets its own job, and you can run and schedule this job from Backoffice Administration Cockpit. Expressway was designed with maximum reuse in mind, so that any enhancements you need to make, whether to add new fields to an existing object type or add a completely new object type, are straightforward and involve minimal changes. A major feature of Expressway is its end-to-end monitoring capability. Not only does Expressway provide detailed monitoring of events and errors that may occur in the SAP Hybris Commerce system; Expressway can also be configured to monitor errors that occur in the SAP Hybris Marketing system.
High-Level Overview (click image to enlarge)
How to Install
- Download the appropriate version of Expressway here.
- Extract sapymktsync to <your_hybris_folder>\bin\ext-integration\ymkt.
- Add the following SAP Hybris Marketing server settings to your local.propertiles file:
- sapymktcommon.odata.url.root=https://<server_name>:<port>
- sapymktcommon.odata.url.sap-client=<server_client_number>
- sapymktcommon.odata.url.user=<username>
- sapymktcommon.odata.url.password=<password>
- Add <extension name=’sapymktsync’ /> to your localextensions.xml file.
- If not already present, add <extension name=’platformbackoffice’ /> to be able to access Backoffice.
- Run the following to rebuild and update your system: ant clean all updatesystem
How to Use
To use Expressway, navigate to the Cronjobs menu in Backoffice. There you will find all the cronjobs delivered with Expressway (click to enlarge):
Next, we configure a cronjob. Select a cronjob and navigate to the Administration tab. There you will find four configurable properties for use with Expressway (click to enlarge):
The properties are described below:
- Batch Size: objects are sent to SAP Hybris Marketing in batches, one batch per OData request. This property defines the maximum number of objects in a batch. The default is 500.
- Catalog Version: specifies the catalog version to be used when selecting certain objects, like products or categories. For example, the ymktProductCronJob only sends products belonging to the catalog version specified in this property.
- Error Stop Count: objects are sent to SAP Hybris Marketing in batches. The attempt to send a particular batch may fail. The ‘Error Stop Count’ property defines the maximum number of failures before the job is aborted. Note that the Expressway cronjobs can also be aborted on demand.
- Perform Validation: part of the end-to-end monitoring capability of Expressway. When enabled, this property issues a call to SAP Hybris Marketing after a batch is sent to see if there were any errors importing that batch. The errors are attached to the cronjob log. Enabling this property impacts performance, so use judiciously.
Multi-Language Support
A cronjob can be configured for a particular language, and Expressway sends the data in that language. For example, if the language property of ymktProductCronJob is set to German, Expressway sends the product descriptions in German. To send the products in multiple languages, you can maintain language-specific copies of the ymktProductCronJob (e.g. ymktProductCronJob_EN, ymktProductCronJob_DE, etc.).
cronjob Logging
Messages logged by Expressway during the execution of a cronjob can be seen in the cronjob log. Open the log and download it:
Make sure to set the logging to the desired level using the ‘Log level file’ dropdown as show in the screenshot above.
Note that that logging level chosen in the dropdown does not set the logging level of sapymktsync. That has to be done separately in your local.properties file. The level chosen in the dropdown only determines which messages get written to the cronjob log file. So if the logging level of sapymktsync is set to ‘INFO’, it does not matter that the level in ‘Log level file’ is ‘DEBUG’. No ‘DEBUG’ messages from sapymktsync are logged.
Note also that the logging level set in the ‘Log level file’ dropdown can be no higher than the value specified in the ‘cronjob.logtofile.threshold’ property. By default this property is set to ‘INFO’, so if you want to set ‘Log level file’ to ‘DEBUG’, as in the screenshot, you would need to set ‘cronjob.logtofile.threshold’ to ‘DEBUG’ also.
Expressway provides a lot of useful logging information. In particular, it tells you the status and execution time of the cronjob, the number and type of the changes that were detected along with the time taken to detect those changes, the number and type of the changes that were marked as ‘processed’ along with the time to process those changes, and the number of objects that were sent along with the time to send them:
17.05.17 18:48:13:393 INFO SUCCESS/FINISHED=2528ms, CollectChanges(NEW=1)=47ms, ConsumeChanges(NEW=1)=106ms, SendModels(1)=1525ms, ValidateImportHeader(1)=840ms
Abandoned Cart
Expressway defines a property that specifies the length of time in minutes after which a cart is considered abandoned. The property name is ‘sapymktsync.syncjob.abandonedcart.interval’ and the default value is 120 minutes. You can specify a custom value for this property in your local.properties file.
How to Enhance
Adding a Field to an Existing Object Type
To add a field to an object type, or to remove a field, or to change the way a field is mapped to its OData fieldname, find the sync service (e.g. CustomerSyncService) for the object type that you’re interested in and make your changes there. For example, to add the customer postal code, which isn’t currently mapped, you would locate the CustomerSyncService class and add the following to the convertAddressModelToMap(…) method:
//<Property Name="PostalCode" Type="Edm.String" MaxLength="10" sap:unicode="false" sap:label="Postal Code"/>
this.optionalPut(map, "PostalCode", address, AddressModel::getPostalcode);
Adding a New Object Type
To add a new object type, create a new sync job and a new sync service.
Adding a New Sync Job
For the new sync job, extend either AbstractSyncJob or AbstractChildSyncJob. The latter is used for object types that are associated with a child object type. For example, OrderSyncJob extends AbstractChildSyncJob because an order has items.
If you extend AbstractSyncJob, you may need to override some or all of the following methods:
- getModelClass() is where you provide the model class for the item type that you wish to send to SAP Hybris Marketing. This method is mandatory. For customers, the method is as follows:
@Override protected Class<CustomerModel> getModelClass() { return CustomerModel.class; }
- getStreamConfigurationItemSelector(…) is where you provide search criteria for your object type. The value provided in this method is used as part of the ‘WHERE’ clause of the Flexible Search query that is constructed by deltadetection. Consider saved carts, which are simply carts whose ‘saveTime’ isn’t null. To retrieve saved carts, SavedCartSyncJob provides the following search criteria:
@Override protected Optional<String> getStreamConfigurationItemSelector(SyncCronJobModel cronJob) { return Optional.of("{item.saveTime} IS NOT NULL"); }
- You may need to communicate object deletions to SAP Hybris Marketing for your new object type. Although deltadetection can detect that an object was deleted, the only information that remains about the object is its automatically-generated SAP Hybris Commerce-specific primary key (after all, a deleted object no longer exists in the database!). Typically, this primary key is not something your SAP Hybris Marketing system will know about. So how do you inform SAP Hybris Marketing that the object was deleted? Expressway provides two methods for this very purpose:
- getItemStoreFunction() is where you provide the function that gets the information to store for your new object type. The stored information is used later to restore the object after it’s been deleted (as a technical aside, the information is stored in the ‘info’ field of a deltadetection item type called ‘ItemVersionMarker’; the ‘ItemVersionMarker’ is used to mark changes to items). SavedCartSyncJob implements getItemStoreFunction() for saved carts. All that is needed to communicate the deletion of a saved cart to SAP Hybris Marketing is the cart’s ID. Hence, getItemStoreFunction() does the following:
@Override protected Optional<Function<CartModel, String>> getItemStoreFunction() { return Optional.of(CartModel::getCode); }
- getItemRestoreFunction() is where you provide the function that initializes the restored object. The restored object’s fields are mapped to OData field names in the sync service method convertModelDeletedToMap(…). Please note that the restored object is only needed for the mapping to OData; it is not persisted in SAP Hybris Commerce. For saved carts, getItemRestoreFunction() does the following:
@Override protected Optional<BiConsumer<CartModel, String>> getItemRestoreFunction() { return Optional.of(CartModel::setCode); }
- getItemStoreFunction() is where you provide the function that gets the information to store for your new object type. The stored information is used later to restore the object after it’s been deleted (as a technical aside, the information is stored in the ‘info’ field of a deltadetection item type called ‘ItemVersionMarker’; the ‘ItemVersionMarker’ is used to mark changes to items). SavedCartSyncJob implements getItemStoreFunction() for saved carts. All that is needed to communicate the deletion of a saved cart to SAP Hybris Marketing is the cart’s ID. Hence, getItemStoreFunction() does the following:
If you extend AbstractChildSyncJob, you may need to override some or all of the following methods in addition to the methods described above.
- getChildClass() is where you provide the model class for the child item type. This method is mandatory. For orders, the method is as follows:
@Override protected Class<OrderEntryModel> getChildClass() { return OrderEntryModel.class; }
- getParentFunction() is where you provide the function that returns the parent of the child item. This method is mandatory. For orders, the method is as follows:
@Override protected Function<OrderEntryModel, OrderModel> getParentFunction() { return OrderEntryModel::getOrder; }
- getChildStreamConfigurationItemSelector(…) is where you provide the search criteria for the child. For saved carts, the method is as follows:
@Override protected Optional<String> getChildStreamConfigurationItemSelector(SyncCronJobModel cronJob) { return Optional.of("{item.order} IN ({{ SELECT {c.pk} FROM {Cart AS c} WHERE {c.saveTime} IS NOT NULL }})"); }
Adding a New Sync Service
The sync service is configured for a specific SAP Hybris Marketing OData service. This is specified in the bean definition of the sync service in sapymktsync-spring.xml:
<bean id="ymktCustomerSyncService" class="com.hybris.ymkt.sapymktsync.services.CustomerSyncService" parent="ymktAbstractSyncService">
<property name="ODataService" ref="ODataService_CUAN_IMPORT_SRV" />
</bean>
...
<bean id="ymktOrderSyncService" class="com.hybris.ymkt.sapymktsync.services.OrderSyncService" parent="ymktAbstractSyncService">
<property name="ODataService" ref="ODataService_CUAN_BUSINESS_DOCUMENT_IMP_SRV" />
</bean>
Notice that the customer sync service uses a different OData service than the order sync service.
If you’re using OData service CUAN_BUSINESS_DOCUMENT_IMP_SRV, extend AbstractBusinessDocSyncService.
If you’re using OData service CUAN_IMPORT_SRV, or if you’re using an OData service whose root entity is like the ‘ImportHeader’ in CUAN_IMPORT_SRV, extend AbstractImportHeaderSyncService.
Otherwise, you can extend AbstractSyncService.
In all cases, the sync service is responsible for mapping the fields of SAP Hybris Commerce items (instances of ItemModel) to OData field names. This is done in method convertModelToMap(…). The sync service is also responsible for sending the maps returned by convertModelToMap(…) to the SAP Hybris Marketing system. This is done in method sendModels(…).
After you’re done creating your new sync job and new sync service, you must declare the corresponding beans in sapymktsync-spring.xml. For example:
<!-- Category -->
<bean id="ymktCategorySyncService" class="com.hybris.ymkt.sapymktsync.services.CategorySyncService" parent="ymktAbstractSyncService">
<property name="ODataService" ref="ODataService_CUAN_IMPORT_SRV" />
</bean>
<bean id="ymktCategorySyncJob" class="com.hybris.ymkt.sapymktsync.jobs.CategorySyncJob" parent="ymktAbstractSyncJob">
<property name="syncService" ref="ymktCategorySyncService" />
</bean>
You must also specify the cronjob that runs your sync job in projectdataConfig.impex. For example:
INSERT_UPDATE SyncCronJob ; code[unique=true] ; job(code) ; catalogVersion(catalog(id), version) ; sessionLanguage(isocode)
; ymktCategoryCronJob ; ymktCategorySyncJob ; Default:Staged ; en
The ImpEx file will be imported when you update your SAP Hybris Commerce server.
And that’s it! You’re now ready to hop on the Expressway!
Product Owner: Emmanuel Piochon (emmanuel.piochon@sap.com)
Main Developer: Robin Vezina (robin.vezina@sap.com)
Developer: Christos Nikolakakis (christos.nikolakakis@sap.com)
Why did the product team choose to go this route? We have several methods now, click stream, data hub and now express way. Personally I like this method -- except for large commerce implementations.
Nicely done! Thank you.
Thanks Anton!
Great article Chris!
I just have one question, as to how Expressway is different/superior compared to the Data hub integration which is OOTB
very nice ... article end to end
Thanks Keshav!
awesome!
We agree, Expressway is awesome 🙂
Thanks Alec!
Good One Chris !! Nice Article..
Some questions as follows,
Thanks.
Hi Shib,
thanks for your questions. Expressway is an alternative for pushing data from Hybris Commerce to Hybris Marketing integration. The direction here is very important. Given the nature of both the sender and receiver, we believe Expressway is the optimal solution in some cases. However, the situation is different for other backend SAP systems, which are the original systems for a lot of data that Commerce is using. For that, the challenges are different and so the solution will be different too.
SAP Cloud Platform Integration will definitely play a key role in the ecosystem in the months to come, and for Commerce to Marketing it is a perfect fit. So our recommendation will be to leverage SCPI as a middleware in between, even though the point-to-point option would be possible too.
Regards,
Emmanuel
Hi Emmanuel,
you may have be right, but the current omnichannel architecture "as is" has a lot of different integration scenarios an both partners and customers are now used to use HCI, SAP PI, DataHub etc. and now an additional one. it gets more and more complex.
Is Expressway for free or part of a license or do we need to license it in the next integration projects seperately?
Regards,
Damian
Hi Damian,
The scenarios running on HCI (SAP HANA Cloud Integration) can be bundled and ran on a PI (SAP Process Orchestration).
I would remind you that HCI is optional. Expressway on ECP can communicate directly to yMKT the same way it is done at runtime for product recommendation, offers, segmentation, clickstream, ect. With Expressway, the complete set of integrations between ECP and yMKT can now run without any middlewares.
Expressway is not a new middleware, it mainly includes a re-written extension of commerce (ECP extension sapymktsync). Instead of re-using the ECP extension y2ysync, it directly consumes deltadetection and provides its own cronjobs on ECP.
The zip available from this blog is free.
The name Expressway is a PoC project. Within ECP release, it will simply replace its predecessor implementation which was using y2ysync and Data Hub for the same integration scenarios.
Regards,
Robin
Ah okay, thats much more clear now! Thx so far.
Hi Emmanuel,
Very useful article indeed. Appreciate that.
Seems like most things are done in yCommerce. Will there be extra job needed in yMkt end?
Best Regards,
Sun
Hi Sun,
You're right, there are no development activities to be done in SAP Hybris Marketing for this integration to work.
Regards,
Chris
Thanks a lot Chris!
Could you please help me with download link. I don;t see any on the page.
Hi Sanjeev,
The link is back now. Let us know if you face any issues.
Regards,
Chris
Hi Chris,
Please help to check the rar file did not include sapymktcommon. I got build exception when run ant clean all
Thanks
Bruce
The extension sapymktcommon is no longer included as part of the blog as it is offered in the standard commerce release 6.5.
Follow this blog : https://blogs.sap.com/2017/10/20/downporting-sap-hybris-marketing-integration-to-earlier-versions-of-sap-hybris-commerce/
Thanks a lot Robin!
Hi,
thanks for the useful blog entry, however, I have some concerns about the implementation:
Do you have any suggestions to bypass this kind of issues? thanks.
/Nabil.
This has been solve in release 1708 which not all customer have upgraded. For this reason, it is not enabled by default. The cronjob can be configured to use “Product1708SyncService.java” instead of “ProductSyncService.java”. With the Product1708SyncService, the cronjob language is ignored and all Language with active set to TRUE will be used. Product1708SyncService use the recent OData service “API_MKT_PRODUCT_SRV”.
Look for the file “sapymktsync/resources/impex/projectdataConfig.impex” and change the commented lines accordingly.
In any case, the usage of a single property can be replaced by overriding the logic of :
Extension : sapymktcommon
Bean : ymktProductURLService
Class : com.hybris.ymkt.common.product.ProductURLService
Changing this bean will also affect the clickstream extension so that both expressway and clickstream use the same image & URL logic.
Is it possible to transmit user click stream? The extension eventtrackingpublisher has only two options: write to the log or write to the queue
The expressway is not related to user click stream. None of the events related to eventtracking are processed by expressway. For expressway, only the persisted model items can be processed by deltadetection.
For clickstream related topic, read : https://help.hybris.com/6.6.0/hcd/5983c2852f3645c8ab56883bd24bb3a7.html
Hello, nice blog
The download link is down again.
goodbye
Hi Pablo,
The link is back up again.
Regards,
Chris
Thanks, I can download it now.
But I think that some impex are missing in the zip file, because the items ymktProductSyncJob, ymktOrderSyncJob, etc don’t exist.
Hi Pablo,
The jobs are defined in the file projectdataConfig.impex, under resources > impex.
All the jobs appear to be there. Please have a second look.
Thanks,
Chris
In the impex file SyncCronJobs are defined, but it makes reference to "jobs" that are not defined mktProductSyncJob, ymktOrderSyncJob, etc
If I try to load this impex I get an error.
The "jobs" are spring bean defined in sapymktsync/resources/sapymktsync-spring.xml
As described in the installation above, modifying "localextensions.xml" and "ant clean all updatesystem" is required.
Thank you Robin Vezina , I’ve found the problem.
In zip file “sapymktsync.build.number” is missing, without this file “ant updatesystem” doesn’t do nothing and then you get an error.
I’ve copied this file from original extension.
Hello dear freinds,
Can any one help me on this?
I want to integrate hybris marketing to hybris commerce?
I have installed hybris commerce latest version and added all the extensions and started the server but i am not sure what can do next level means where should i provide the connection hybris marketing to hybris commerce?
By using Expressway what are the settings i have to do?
Please let me know some one
Q : Can any one help me on this?
A : Yes.
Q : I want to integrate hybris marketing to hybris commerce?
A : Only you can answer this.
Q : I have installed hybris commerce latest version and added all the extensions and started the server but i am not sure what can do next level means where should i provide the connection hybris marketing to hybris commerce?
A : https://help.hybris.com/6.7.0/hcd/24b2100bbb8e46f5ba4df85b4e5b9c16.html
Q : By using Expressway what are the settings i have to do?
A : Read the section "How to Install" above.
Hi there!
Could you please enable the download link again?
Thanks in advance!
Link is enabled.
Hi Christos,
I've been running in to some problems with this.
First I coudn't get my Hybris Commerce 6.4 to build with the Expressway extension. Fixed that with updating the sapymktcommon to the version from 6.5. (I later found the blog about down porting from 6.5 and followed the instructions there.)
Second when look in back office I don't get any relevant cronjobs, only jobs. For instance I have a job with the "Code" set to ymktSavedCartSyncJob. That corresponds to "Job definition" in your example. Any clue why it's like that?
All help is very appreciated.
To find the CronJobs, import the impex :
\sapymktsync\resources\impex\projectdataConfig.impex
Hi,
Last week it was possible to pick any, out of 4 I think, Expressway artifacts by clicking on a link but now a mail needs to be sent, to emmanuel.piochon@sap.com. Why is that?
This current public sharing tool used for Expressway download is being phased out at SAP. We are still in the process of clarifying how to replace it with the new one. In the meantime, the guidance is to send an email to me so the provisioning of the requested zip can be done on a one to one basis.
Thanks,
Emmanuel
Hi, my customer currently uses Expressway with SAP Commerce in 6.7 version. He is in production.
He is going to upgrade SAP Commerce to 1905. The latest version of Expressway is 1811. Is it compatible with 1905 ?
Thanks.
Hi Abdelhalim,
Yes, Expressway will run on Commerce Cloud 1905 (all the extensions Expressway depends on are available in 1905).
Regards,
Chris
Hi,
We want to integrate Commerce 6.5 with the latest version of Marketing Cloud (1911). Expressway is the best option? or how can we make a standard integration between those versions?
Thank you so much
Hi Christos,
I am using hybris 6.6 version already
I have done the setups and followed the steps 1-5.
and build the system and started the server.with system update.
However I am unable to see the ymkt cron job generated in backoffice. Is there any thing else need to do configuration wise.As cron job is OOTB created for these 7 types.
Please suggest If I am missing anything.
Thanks a lot.
Hi Rakeshkumar,
Try manually uploading the impex file (sap.hybris.expressway/sapymktsync/resources/impex/projectdataConfig.impex) containing the jobs.
Best regards,
Chris
Hi,
Could you please help me with download link. It's broken.
kind regards,
Hi Cesar,
It's back up.
Best regards,
Chris
Thank you
Hi,
Can you please share a new link for download, this one is broken 🙁
Thanks in advance
Hi Edvin,
It's back up.
Best regards,
Chris
Hi Christos Nikolakakis!
Could you please share again the link to download?