Deploy Swiftlet
Overview
The Deploy Swiftlet manages the deployment and lifecycle of SwiftMQ bundles (modules or applications) within the router. It monitors specified directories for deployment changes, such as adding, removing, or updating bundles, and handles these events automatically. The Swiftlet provides a structured way to define multiple deployment spaces, each with its own monitoring interval and directory.
Features
Deployment Spaces
A deployment space is a logical configuration that defines a directory on the file system to be monitored for bundle deployments. Each deployment space is configured with a path and a check interval. The Swiftlet periodically scans the specified directory for changes (such as new, removed, or modified bundles) and triggers the appropriate deployment actions. This mechanism allows administrators to organize deployments by grouping related bundles into separate spaces, each with its own monitoring behavior.
When a deployment space is created, the Swiftlet ensures the directory exists, and on cold start, it purges any leftover artifacts from previous deployments. The check interval determines how frequently the directory is scanned for changes. If the interval is modified at runtime, the Swiftlet dynamically adjusts its timer to reflect the new value.
Automatic Bundle Event Handling
The Swiftlet detects three types of bundle events: addition, removal, and change. When a bundle is added, it is deployed and tracked in the usage list. When a bundle is removed, it is undeployed and removed from the active deployments. If a bundle is changed (updated), the Swiftlet undeploys the old version and redeploys the new one. Any errors during deployment result in the bundle being removed and a log entry being generated, ensuring that only valid bundles remain active.
Usage Tracking
For each deployment space, the Swiftlet maintains a usage entity that lists all currently active deployments. Each deployment entry records the deployment time and the directory where the bundle is located. This provides administrators with a clear view of which bundles are currently deployed and their respective details.
Configuration Example:
<swiftlet name="sys$deploy">
<deploy-spaces>
<deploy-space name="main-deploy" path="deployments/main" check-interval="30000"/>
<deploy-space name="test-deploy" path="deployments/test"/>
</deploy-spaces>
</swiftlet>
Configuration Guide
Setting Up a Custom Deployment Space
Use this scenario when you want to monitor a specific directory for bundle deployments, with a custom scan interval. This is useful for environments where deployment frequency or directory structure differs between applications or teams.
- Decide on the file system path where bundles will be deployed (e.g., deployments/custom).
- Determine the desired check interval in milliseconds (e.g., 15000 for 15 seconds).
- Add a new deploy-space entry under the sys$deploy Swiftlet in routerconfig.xml, specifying the path and check-interval attributes.
<swiftlet name="sys$deploy">
<deploy-spaces>
<deploy-space name="custom-deploy" path="deployments/custom" check-interval="15000"/>
</deploy-spaces>
</swiftlet>
Configuration Reference
The top-level entity in routerconfig.xml is <swiftlet name="sys$deploy">.
<deploy-spaces> in <swiftlet name="sys$deploy">
Deploy Spaces
Each <deploy-space> entry is identified by its name attribute (the Deploy Space).
| Parameter | Type | Default | Mandatory | Reboot Required | Description |
|---|---|---|---|---|---|
path |
String | — | Yes | No | Path Name |
check-interval |
Long | 60000 |
Yes | No | Check Interval for Deployment Changes |
<swiftlet name="sys$deploy">
<deploy-spaces>
<deploy-space name="..." path="..." check-interval="..."/>
</deploy-spaces>
</swiftlet>