Deploying custom code to xConnect and the Marketing Automation Engine

Sitecore MVP & Principal Developer at Valtech
Valtech, UK

novembro 23, 2018

Over the last few years the deployment footprint of a fully functional Sitecore application has shifted hugely. It’s no longer as simple as one database server and a couple web nodes – now you need to consider all kinds of different infrastructure.

What are the different parts of Sitecore 9?

  • xConnect – a separate web application to your main site
  • AutomationEngine – this runs as a windows service
  • IndexWorker – this also runs as a windows service
  • Website – much like the good ol’ days 

Adding your own customizations

It’s pretty simple to setup your own custom facets. However what’s slightly harder is how do you deploy these to all of the different functions above? If the dll’s and configs don’t match between e.g. the website and xConnect you will get errors in the logs – luckily these do a good job of explaining the mismatch.

Sharing the love

In its simplest form the process of deploying your custom facet relies on 2 things – the dll that contains the facet and a json representation of the facets. To generate the JSON try this.

Automate the boring stuff

No one likes doing the same thing again and again, especially if you consider deploying something like this to multiple servers in the cloud. 

For a recent demo I built a process that worked both locally and remotely. This was great as the octopus deploy step only had to run one exe and the whole deployment glued together as expected.

Just show me the codes!

Just before we do I’ll quickly explain the steps involved:

  1. Build the code 
  2. Write the json schema
  3. Deploy the model config (see the sitecore post earlier about this format)
  4. Deploy the dlls
  5. Deploy the patch configs
  6. Deploy the agent configs. Note these assume you are using Slow Cheetah to transform accordingly for each environment

Before you run it you need to:

  1. Correct the references to things like xConnect etc
  2. Correct the references to the dlls you want to include and set their names in the DeployDlls method (var dllsToCopy)
  3. Set the deploymentFolder

All the source code is available online here

One file of note is sc.MarketingAutomation.ActivityTypes.xml – this allows you to patch in things like custom MA Actions, setup dependency injection within the MAEngine and a whole raft more.

Original article was posted on Boro2g Blog: Deploying custom code to xConnect and the marketing automation engine 

Contate-nos