Skip to content

Publisher

Juraj Bielik edited this page Oct 16, 2019 · 8 revisions

Kentico Kontent Docs - Publisher

Overview

Publisher is a microservice responsible for publishing content items in a Kentico Kontent project, whose content is then visible on the Kentico Kontent Docs website. The service is written in TypeScript as an Azure function with an HTTP trigger and a timer trigger.

Publisher has been created in order to solve overhead with publishing modular content of a content item. It searches for items of any content type in specific workflow steps: Cascade publish and Scheduled.

  • Items in the Cascade publish workflow step are published alongside its all inner items (modular content of richtext elements, including inner items of inner items and so on...).

  • Items in the Scheduled workflow step are not published, but all of their inner items are published.

Specification

Triggers

HTTP

The HTTP trigger provides a way to immediately run the service by making an HTTP GET or POST request to the Azure function endpoint.

Timer

The service is run periodically every 5 minutes so the items are published in a reasonable time so the content developer can see the result on the website in a few minutes.

How it works

The Azure function retrieves all content items of all content types (any item can be set to the Cascade publish or the Scheduled step) using Kentico Kontent Delivery SDK. After that, these items are checked for their workflow step using Content Management API SDK. Items in the Cascade publish and Scheduled step are then further processed - all of their inner items in richtext elements are published. Components in richtext are ignored - publishing them would cause an error. Inner items in element of type Linked items are not being published, the only exception is content type code_samples - its linked items code_sample are being published.

After all inner items are published with success, then the item set to one of the workflow steps is published. Items in Scheduled step are published only if the scheduled time is less than 10 minutes away in the future from the current time - this ensures that the item will be processed earlier by the publisher service rather than Kentico Kontent's publishing service (that would result in not published inner items).

If there is any kind of error while publishing content items, e.g. a required element is not filled, a notification is sent to the Teams channel, whose URL is specified in the environment variable Teams.NotificationUrls, and the process continues with other content items.