How Remote File Triggers Work
A Remote File Trigger submits a Job when a matching file is present in, absent from, or available in a remote object store. Amazon S3 buckets and Azure Blob Storage containers are supported. This topic covers the Connection setup, how the Trigger behaves, and how to troubleshoot it. To add the Trigger to a Job or Folder, see Running a Job Based on a Remote File for the JAMS Client, or Running a Job Based on a Remote File for the Web Client.
The Remote File Trigger works like the File Trigger, with one difference: JAMS polls the remote store on an interval instead of watching a local or network folder. The storage service does not push notifications to JAMS, and nothing is installed on the storage side. The polling is done by a JAMS Agent.
Before You Begin
A Remote File Trigger reads its location and sign-in details from an Amazon S3 or Azure Blob Connection in the Connection Store. These are the same Connection types JAMS already uses for file transfers and the Azure Blob Execution Method. No new Connection type is needed.
Amazon S3
- Create a Credential. Enter the AWS access key ID in the Logon As field and the secret access key in the Password field. If Logon As is empty, JAMS uses the Credential's name as the access key ID.
- Create an Amazon S3 Connection. See Adding a Connection to an Amazon S3 Bucket.
- Credentials: the Credential from step 1.
- AWS S3 Bucket name: optional. A Remote File Trigger with an empty Container watches this bucket.
- AWS S3 Region: optional. JAMS asks AWS for the bucket's region first and uses this value if that request fails. If neither is available, JAMS uses
us-east-1.
The Remote File Trigger does not use the Connection's Address or Folder Name properties. Set the folder in the trigger's Remote Path instead.
Azure Blob
- Register an application in Microsoft Entra ID and create a client secret for it.
- Create a Credential. Enter the client secret in the Password field. Logon As can be left empty.
- Create an Azure Blob Connection with the Tenant Id, Client Id, Storage Account Name, and the Credential from step 2. See Connections for Integrations.
The Remote File Trigger connects to https://<storage account>.blob.core.windows.net, the Azure public cloud endpoint.
Permissions
The Remote File Trigger only lists files. It never reads, moves, or deletes them. The identity on the Connection needs the following:
| Provider | Minimum permission |
|---|---|
| Amazon S3 | s3:ListBucket on the bucket. Also grant s3:GetBucketLocation if the Connection does not specify a region. |
| Azure Blob | The Storage Blob Data Reader role on the container or on the storage account. |
The Job the trigger submits usually needs more than this, for example to read or delete the file. Grant that to the Job's own Credentials.
How It Works
Inherited Triggers
A Remote File Trigger on a Folder is inherited by every Job in that Folder. Each inheriting Job waits on the watch separately, and appears separately in Impacted Jobs.
When you edit and save an inherited Remote File Trigger from a Job, JAMS saves the change as an override on that Job. The Folder's Trigger and the other Jobs that inherit it are not changed. An inherited Trigger cannot be deleted or reset from the Job.
The RemoteFileWatch Job
JAMS creates a system Job, \JAMS\WatchJobs\RemoteFileWatch, and submits an entry of it for each distinct watch. In the Monitor, a watch entry is named Remote File Watch: followed by the File Name, and is submitted by JAMS RemoteFileWatch. It stays in Executing while it waits.
Triggers that are identical share a single watch entry, even across Jobs and Folders. To be identical, they must match on all of the following after tokens are resolved: Connection, Container, Remote Path, File Name, File Presence Option, Minimum Size, Minimum File Count, Polling Interval, and Agent. Any difference, including a different Polling Interval, creates a separate watch entry.
All watch entries for the same Connection and Agent run in one shared process on that Agent. That process lists each container and Remote Path once per poll, however many triggers watch it. When several watches share a container, the container is polled at the shortest Polling Interval among them, so a Trigger can be checked more often than its own setting.
Lifecycle
- Save. When a Remote File Trigger is added or changed, JAMS stops the old watch and arms a new one within a few seconds.
- Arm. JAMS resolves the tokens and joins a matching watch entry, or submits a new one.
- Poll. The first check runs a few seconds after the watch starts, then every Polling Interval.
- Satisfy. When the condition is met, the watch entry completes, the Trigger's state changes to Fired, and the Job is submitted.
- Re-arm. When every entry the Trigger submitted has completed, the Trigger returns to Enabled and JAMS arms a fresh watch.
The watch keeps no record of which files it has already seen. If a matching file is still in the container when the Trigger re-arms, the Trigger is satisfied again at once. The Job the Trigger submits should move, rename, or delete the files it processes.
Present, Available, and Absent
| Option | Satisfied when |
|---|---|
| Present | At least Minimum File Count files match File Name, and each counted file is at least Minimum Size bytes. |
| Available | The same as Present, and each counted file has finished being written. |
| Absent | No file matches File Name. Minimum Size and Minimum File Count are ignored, so a 0-byte matching file still counts as present. |
When an upload has finished depends on the provider:
- Amazon S3 and Azure block blobs, which are the normal Azure upload type: neither service lists a file until its upload completes, so a listed file is always available.
- Azure append blobs, the type that log writers keep adding to: JAMS treats an append blob as available once it is sealed, or once its size and last-modified time have not changed for 5 minutes. The 5 minutes is measured from when JAMS first sees the blob, so an append blob that was last written long ago still waits 5 minutes after the Trigger first finds it.
While a Trigger with a Minimum File Count above 1 is waiting, the watch entry's log reports progress, for example Found 2 of 3 matching files. Still waiting.
And Groups
A Remote File Trigger takes part in And Groups like any other Trigger. When it is in the same And Group as other Triggers, the Job is submitted only after every Trigger in the group has fired.
Fast Fire Protection
Remote File Triggers are subject to the same Fast Fire limit as File Triggers, counted per Trigger. When a Trigger keeps firing within the Fast Fire Interval of its previous fire (1 minute by default) and exceeds the Fast Fire Limit (5 by default), JAMS delays the next submission by the Fast Fire Submit Delay (1 minute by default). If the Scheduler is configured to disable Triggers that fast fire, the Trigger is disabled instead and must be re-enabled. Re-enabling it resets the count.
Scheduler Restart
Watch entries are canceled when the Scheduler shuts down. When the Scheduler starts, it re-adopts any watch entries that are still active and re-arms every enabled Remote File Trigger, joining an existing watch or submitting a new one. Jobs that were waiting are not failed. A Trigger that was in the Fired state is re-armed after the Job it submitted completes.
Choosing a Remote Path
Remote Path is sent to Amazon S3 or Azure as the listing prefix, so only files under that prefix are returned. File Name matching is done by JAMS after the list is returned.
Each poll reads at most 25,000 objects under the prefix. On a container larger than that, a broad Remote Path has two costs:
- More list requests, which your cloud provider bills for.
- An incomplete scan. A Present or Available Trigger only sees the first 25,000 objects and can miss a match beyond them. An Absent Trigger is never satisfied by an incomplete scan.
Use the narrowest Remote Path that contains the files you are watching for.
Missing Remote Path or Container
- A Remote Path that does not exist is treated as an empty folder. A Present or Available Trigger keeps waiting, and an Absent Trigger is satisfied. No message is logged.
- A bucket or container that does not exist is logged once in the watch entry's log, for example
The S3 bucket 'name' was not found. Still watching - the container is checked again on every poll.JAMS keeps polling and logsThe container now exists.when it appears.
A missing bucket or container is treated as empty, so an Absent Trigger is satisfied immediately. Check the Container name on Absent Triggers carefully: a misspelled name fires the Trigger on the first poll.
Archived Files
JAMS does not check the storage tier. Objects in Amazon S3 Glacier storage classes or the Azure Archive tier are listed, counted, and treated as available like any other file. The Trigger can fire for a file that the Job cannot read until it is restored. Use a Remote Path that does not contain archived objects.
Monitoring a Remote File Watch
Watch Entry Log
Each watch entry logs its settings when it starts: the Connection, the Container, or (the connection's default) when the Container is empty, the file being watched for, the File Presence Option, the Minimum Size, and the Minimum File Count. Problems and recoveries are logged in the same entry. See Error Handling.
Impacted Jobs
To see which Jobs are waiting on a watch, open the watch entry in the Monitor and click the Impacted Jobs tab. Each waiting Job is listed once, with its Folder path and the type RemoteFileTrigger. A Folder Trigger appears once for each Job that inherits it. See Using the Monitor View.
The list is read from the Scheduler while the watch is active. A completed watch entry has no Impacted Jobs.
Error Handling
A Remote File Trigger never fails the Jobs that are waiting on it. Problems are written to the watch entry's log, and the watch keeps polling.
Credentials Stop Working
When credentials are rotated or expire, for example a rotated AWS access key or an expired Entra ID client secret, JAMS keeps polling in case the rejection is temporary. When every container watched through that Connection and Agent has rejected the credentials on 10 consecutive polls, and at least 10 minutes have passed, the shared process stops. Each watch entry logs:
Every container on this watch's connection rejected its credentials on the last 10 attempts. The shared host is stopping so this watch can be replaced by one that uses the connection's current settings.
JAMS submits replacement watch entries 5 minutes later. They use the Credential currently set on the Connection. After you fix a Credential, allow at least 15 minutes for watches to recover, or edit the Connection to restart them sooner. See Connection Changes.
Only rejected credentials count toward this limit. A permission problem, such as S3 AccessDenied or Azure AuthorizationPermissionMismatch, does not restart the watch, because a restart would not fix it.
Permission, Throttling, and Network Problems
Permission errors, throttling, timeouts, and network problems are logged once, when they start, in the log of each watch entry they affect:
Cannot read <location>: <reason> Still watching - this will be retried until it succeeds.
JAMS keeps polling, and logs <location> can be read again. when the problem clears. If the process cannot connect to a container, it logs Cannot connect to container '<name>' and then Connected to container '<name>'. when it succeeds.
Missing Bucket or Container
See Missing Remote Path or Container.
Connection Changes
When you save a change to a Connection's properties, JAMS restarts every Remote File Watch that uses that Connection. The watch entries are canceled and resubmitted at once with the new settings, and the waiting Jobs are not failed. The new watch checks the container a few seconds later.
Renaming the Connection, changing its permissions, or saving it with no changes does not restart its watches.
Changing the Credential itself, for example its password, is not a change to the Connection and does not restart the watch. A running watch keeps using the secret it started with until that secret is rejected. To apply a new secret right away, make and save a change to the Connection.
If the RemoteFileWatch Job Is Missing
The \JAMS\WatchJobs\RemoteFileWatch Job is created automatically. If it is deleted, Remote File Triggers cannot start a watch and do not fire. The error is written only to the Scheduler's trace, not to a Monitor entry. Do not delete or move this Job.
Polling Latency
A Remote File Trigger finds a file up to one Polling Interval after it arrives, plus the time the Job takes to be submitted. A shorter interval finds files sooner but sends more list requests, which your cloud provider bills for. When several watches share a container, they share one listing per poll, so adding Triggers on the same container and Remote Path does not add requests.