Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.



Page Properties


Status

Status
colourYellow
titlePROGRESS

Priority1
Notecontent in tutorial System Hooks
AssigneeAntje

Ressources

partly described in Tutorial System Hooks

Remarks

concept article linking to the respective tutorials


Excerpt

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


Section
bordertrue


Column

Table of Contents

Table of Contents
exclude(Table of Contents|Read on|Another Tutorial|Another Concept Article|Another interesting Tutorial)


Introduction

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

Any changes to the AMQP Hook configuration require a restart of the API Gateway.

Main part(s)

This tutorial shows how to set up an AMQP system hook to generate a message when importing a document. We’ll go through an example in which we’ll configure a system hook that sends messages to a messaging system to perform an asynchronous full-text indexing (more about asynchronous full-text indexing can be found here).

Requirements

This tutorial requires:

Table of Contents

...

...

Introduction

With an AMQP system hookHook, messages are sent to a configured messaging system using using Advanced Message Queuing Protocol 1.0 (AMPQ). Where and when these messages are sent is defined in the system hook configuration.System hooks are configured in the file \service-manager\config\system\systemHookConfiguration.json in json format. System Hook configuration. The AMQP configuration is located in the amqp key under the systemhooks top-level key. It is represented as a list of one or more system hooks System Hooks whose parameters are described in the table below:

Parameter

Type

Description

enable
booleanIs this configuration active/enabled?
predicate
string

Condition that specifies when the system hook is used. Supported scripting languages: Spring Expression Language (SpEL) und Javascript.

type
stringDefines the processing step for which the system hook is to be used.
url
stringAMQP server endpoint, e.g. 127.0.0.1:5672.
user
stringUsername for the AMQP server.
password
stringPassword for the AMQP server.
queue
stringName of the queue to which the messages are written.
bulkSize
integerMaximum bulk size for a message.

...

We configure an AMQP system hook to send messages to a messaging system when importing compound documents. For this we use the following configuration:
systemHookConfiguration.json

...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

...

. Of course, a messaging system needs to support AMQP 1.0. Any changes to the AMQP Hook configuration require a restart of the API Gateway.

Code Block
titlesystemHookConfiguration.json
linenumberstrue
{
    "systemhooks": {
        "amqp": [
            {
                "enable": true,
                "predicate": "spel:(contentStreams != null && contentStreams.size() > 0 && contentStreams[0]['range'] != null && contentStreams[0]['range'].length() > 0) ? true : false",

...


                "type":

...

 "object.insert.document",

...


                "url":

...

 "127.0.0.1:5672",

...


                "user":

...

 "admin",

...


                "password":

...

 "admin_pwd",

...


                "queue":

...

 "lc.textextraction",

...


                "bulkSize":

...

 10
            }
        ]
    }
}


For AMQP, this configuration has exactly one system hook of type object.insert.document relevant to the API-Gateway. If the evaluation of the predicate for a document on import results in is true (in our example only for compound documents), the API-Gateway sends a message with the metadata of the document to the defined messaging system. In addition, the configuration specifies a bulkSize of 10, i.e. for a batch import of 100 documents matching the predicate, 10 messages with 10 metadata entries per message are written to the queue named lc.textextraction.

Activating the AMQP System Hook

In our example of asynchronous full-text indexing, the API-Gateway is responsible for evaluating the system hook. To apply the configuration, the API-Gateway must be restarted after saving the configuration file. Messages will then be send to the messaging system for the import of compound documents.

...

Summary

In this tutorialarticle, we covered the AMQP system hook Hook configuration using the example of asynchronous full text indexing.

Subsection(s)

Code Block
languagejava
titleFor Loop in Java (brief, concise title)
linenumberstrue
for (int i = 0; i < 10; i++)
{
	System.out.println("Hello World " + i);
}

...

The second type of System Hooks in yuuvis® Momentum is the Webhook.


Another Concept Article

...

Info
iconfalse

Read on

Section


Column
width25%

...

Another Tutorial

Brief summary of the article linked.

...

width25%

Concept of System Hooks

Insert excerpt
Concept of System Hooks
Concept of System Hooks
nopaneltrue


Column
width25%

...

Another interesting Tutorial

...

Webhooks

Insert excerpt
Webhooks
Webhooks