Skip to main content
Skip table of contents

Events and WebHooks

Prerequisite

In order for WebHooks to work, events have to be enabled globally for the WebTSM Services.

Example:

XML
<HAKOMConfiguration>
    <products>
        <WebTSMServices>
            <Events>
                <Enabled>true</Enabled><!-- Globally enables(true)/disables(false) events Default: false-->
                <Limits>
                    <MaxRequestContent>524288</MaxRequestContent><!-- Maximum size of request body that can be sent to the event-subscriber (in Byte). Default: 524288 Byte = 512 KB-->
                </Limits>
            </Events>
        </WebTSMServices>
    </products>
</HAKOMConfiguration>

Persistence

WebHook configurations are stored in local files by default. Whenever a user registers a new WebHook using the endpoint:

CODE
POST /hooks

and setting the "Persist" property of the WebHooks configuration to true a file is created in a .hooks directory in the services application folder. This file contains all the information about the WebHooks registration.

These files are then read when the service is restarted to restore the persisted WebHooks.

Sharing WebHooks between Services

As of version 3.9.2.5 multiple Services can share WebHook registrations. This may be required if multiple services are set up behind a proxy in a load balanced configuration.

There are two ways in which this can be configured.

  • Storing WebHook registrations in a shared location in the file system
  • Storing WebHook registrations in a centralized database

In both cases, synchronisation is not instantaneous but instead requires each service to periodically check for added/modified/removed WebHook registrations.

The interval in which this occurs is configured as follows:

XML
<HAKOMConfiguration>
	<products>
		<WebTSMServices>
			<HookRegistrationStorage>
				<ReloadInterval>00:05:00</ReloadInterval><!-- any time span from 00:00:01 upwards maybe set here -->
			</HookRegistrationStorage>
		</WebTSMServices>
	</products>
</HAKOMConfiguration>

Note that checking for changes to the WebHook registration incurs some overhead and thus a performance penalty. Thus, the interval should be set to a sensible value depending on your use case. If you rarely change WebHook registrations, several minutes should suffice.  

Storing WebHook Registrations in a Shared Folder

If all services have access to a shared location in the file system, they may be configured to use that location instead of the default local .hooks directory:

XML
<HAKOMConfiguration>
	<products>
		<WebTSMServices>
			<HookRegistrationStorage>
				<ReloadInterval>00:05:00</ReloadInterval>
				<Type>FileSystem</Type>
				<Source>\\Share\\WebHookRegistrations</Source><!-- Relative paths are relative to the services directory, absolute paths (including UNC paths) are allowed. Default: .hooks -->
			</HookRegistrationStorage>
		</WebTSMServices>
	</products>
</HAKOMConfiguration>

Storing WebHook Registrations in a Database

XML
<HAKOMConfiguration>
	<products>
		<WebTSMServices>
			<HookRegistrationStorage>
				<ReloadInterval>00:05:00</ReloadInterval>
				<Type>Database</Type>
				<Source>DatabaseName</Source><!-- Must correspond to the name of a database configured under //HAKOMConfiguration/dbconnections -->
			</HookRegistrationStorage>
		</WebTSMServices>
	</products>
</HAKOMConfiguration>



JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.