System Hooks

Define additional actions triggered by specified events, extend the functionality of yuuvis® Momentum API.

Table of Contents

Introduction

System hooks are functions that apply to core functions of the yuuvis® Momentum API whenever certain conditions are met and that extend or modify those functions. As such, they serve as a modular, external approach for introducing new functionalities as extensions of already existing ones. There are two different types of system hooks available: AMQP hooks as a pure messaging tool and webhooks with multiple possible applications.

System Hooks Types

System hooks catch the call for a function under certain conditions in order to extend or modify the requested process. Thus, it is possible to externalize functional extensions or modularize components of the function call. In order to react to a function call under a certain condition, the latter is defined as a parameter for the corresponding system hook in its predicate attribute. The set of conditions that need to be met in order for a system hook to activate are defined in a SpEL (Spring Expression Language) statement that needs to yield a True result in order to trigger the system hook.

Two different types of system hooks can be used in yuuvis® Momentum that support two different use cases. Both of them react to function calls under a specified condition defined in SpEL, but their behavior after activation is completely different.

AMQP Hooks

AMQP stands for Advanced Message Queuing Protocol 1.0, which is the encoding scheme that AMQP hooks are working with. AMQP hooks are used to generate messages for the AMQP messaging systems whenever any relevant function is performed. They are instantiated using the URL and credentials for an existing messaging queue. The process flow itself is proceeding at the same time and cannot be modified with an AMQP hook.

Any changes to the AMQP hook configuration require a restart of the API-gateway service. More on AMQP hooks can be found here.

Webhooks

A webhook extends a function by an HTTP call. Whenever the predicate of a webhook delivers a True result, an optional HTTP call to a web URL defined in the webhook configuration is performed. The process flow is interrupted until the webhook activity is finished. Thus, the webhook can perform additional processing steps before passing the data back to resume the interrupted main process. If the predicate of a Webhook delivers a False result, the HTTP call is skipped.

Any changes to the webhook configuration require a restart of the services that are responsable for the call of the affected functions. More on webhooks can be found here.

Configuring System Hooks

System hooks are configured in the \service-manager\config\system\systemHookConfiguration.json configuration file within the service manager in JSON format. Any changes to the system hook configuration will not apply until the affected services have been restarted.

>> systemHookConfiguration.json

Summary

This article gave an introduction into the concept of system hooks in yuuvis® Momentum. Detailed information on the two different types of system hooks available can be found in the specific articles: "AMQP Hooks" and "Webhooks". An example configuration of webhooks is shown in the "Preprocessing Metadata using Webhooks" tutorial.


Read on

AMQP Hooks 

System Hooks, that allow for messaging triggered by function calls under specified conditions. Keep reading

Webhooks

A system hook that extends a function call by an HTTP call under defined conditions. Keep reading

Preprocessing Metadata using Webhooks

An example Webhook consumer service set up using Java and Spring Boot.   Keep reading