This example shows how to configure automatic data file updates for 51Degrees On-premise IP Intelligence.
You will learn:
- How to create a Pipeline that uses 51Degrees On-premise IP Intelligence with automatic updates
- How to configure different update mechanisms (startup, filesystem watcher, daily auto-update)
- How to control when a new data file is sought and loaded by the IP Intelligence software
This example illustrates various parameters that can be adjusted when using the On-premise IP Intelligence engine, and controls when a new data file is sought and when it is loaded by the IP Intelligence software.
Three main aspects are demonstrated:
- Update on Start-Up
- Filesystem Watcher
- Daily auto-update
Distributor Service and License Key
For production use, you will eventually need to use a Distributor service and license key to keep your data file updated. However, for now this example requires a custom URL where an updated data file will be hosted.
To obtain access to enterprise data files, please contact us.
Configuration
- the pipeline must be configured to use a temp file .useOnPremise(dataFilename, true)
- a DataUpdateService must be supplied UpdateCompletionListener completionListener = new UpdateCompletionListener();try (DataUpdateService dataUpdateService = new DataUpdateServiceDefault()) {dataUpdateService.onUpdateComplete(completionListener);....setDataUpdateService(dataUpdateService)
- update on start-up must be specified, which will cause pipeline creation to block until a file is downloaded .setDataUpdateOnStartup(true)
File System Watcher
You can configure the pipeline builder to watch for changes to the currently loaded IP Intelligence detection data file, and to replace the file currently in use with the new one. This is useful, for example, if you wish to download and update the IP Intelligence file "manually" - i.e. you would download it then drop it into place with the same path as the currently loaded file. That location is checked periodically (by default every 30 mins) and this frequency can be configured.
Pre-Requisites
- a license key
- the file location of the existing file
Configuration
- the pipeline must be configured to use a temp file .useOnPremise(dataFilename, true)
- a DataUpdateService must be supplied UpdateCompletionListener completionListener = new UpdateCompletionListener();try (DataUpdateService dataUpdateService = new DataUpdateServiceDefault()) {dataUpdateService.onUpdateComplete(completionListener);....setDataUpdateService(dataUpdateService)
- configure the frequency with which the location is checked, in seconds (10 mins as shown) .setUpdatePollingInterval(10*60)
Daily auto-update
Enterprise data files are usually created four times a week. Each data file contains a date for when the next data file is expected. You can configure the pipeline so that it starts looking for a newer data file after that time, by connecting to the 51Degrees distributor to see if an update is available. If one is, then it is downloaded and will replace the existing IP Intelligence file, which is currently in use.
Pre-Requisites
- a license key
- the file location of the existing file
Configuration
- the pipeline must be configured to use a temp file .useOnPremise(dataFilename, true)
- a DataUpdateService must be supplied UpdateCompletionListener completionListener = new UpdateCompletionListener();try (DataUpdateService dataUpdateService = new DataUpdateServiceDefault()) {dataUpdateService.onUpdateComplete(completionListener);....setDataUpdateService(dataUpdateService)
- Set the frequency in seconds that the pipeline should check for updates to data files. A recommended polling interval in a production environment is around 30 minutes. .setUpdatePollingInterval(30*60)
- Set the max amount of time in seconds that should be added to the polling interval. This is useful in datacenter applications where multiple instances may be polling for updates at the same time. A recommended ammount in production environments is 600 seconds. .setUpdateRandomisationMax(10*60)
Location
This example is available in full on GitHub.
To test this example, you need to:
- Host an IP Intelligence data file (.ipi) at a custom URL accessible to this application
- Provide that custom URL using the WithDataUpdateUrl parameter
- No license key is required when using a custom URL
For production use, you will eventually need to use a Distributor service and license key to keep your data file updated.
To obtain access to enterprise data files for hosting, please contact us.
