Skip to content

File poller

A file poller picks up files from a directory and turns each one into a message. Use it to send documents from your own systems to a partner. This page explains its settings and its path pattern.

How it works

  1. When the poller starts, it creates its Base Directory if it does not exist. If it cannot, the instance ends in state Error and MicroB2B raises the alert plugin_failed.
  2. Every Polling Interval, the poller looks for files below the base directory.
  3. For each file that fits the Path Pattern and the File Pattern, it works out who the file is from and to.
  4. It stores the file as a message and matches the routes.
  5. It moves the file to the Processed Directory, or deletes it when Delete After Send is on.

Add a file poller

  1. Go to Plugins > File Pollers and click + New File Poller.
  2. Enter a Name, such as poller_inbox.
  3. Enter the Base Directory, such as /data/outbox.
  4. Keep the Path Pattern {to}/{filename}, or change it (see below).
  5. Enter a Processed Directory, or turn on Delete After Send.
  6. Click Create.
  7. Restart MicroB2B so the poller starts.
  8. Add a route from the poller to a target, for example an AS2 sender.
A file poller’s settings A file poller’s settings

Settings

SettingWhat it doesDefault
NameThe instance name. Lower case letters, digits, _ and -.(required)
EnabledA disabled poller does not run.on
Base DirectoryThe directory to scan.(required)
Path PatternWhere files are below the base directory, and what their path says. See below.{to}/{filename}
File PatternA pattern the file name must match, such as *.xml or order_*.txt.*.*
Polling Interval (seconds)How often to scan. At least 1.5
From (Organization)A fixed sender. Leave empty when the path pattern has {from}.(empty)
To (Partner)A fixed recipient. Leave empty when the path pattern has {to}.(empty)
Processed DirectoryWhere picked-up files are moved. The file keeps its path below the base directory.(empty)
Delete After SendDelete picked-up files instead of moving them.off

You need exactly one of Processed Directory and Delete After Send.

A changed poller takes effect when you restart it on System > Services, or restart MicroB2B.

Path pattern

The path pattern describes where files are, relative to the base directory. It is made of parts separated by /. Each part is either fixed text or one placeholder.

PlaceholderWhat it captures
{to}The name of the partner the file is for
{from}The name of the organization the file is from
{filename}The file itself. It is always the last part. It becomes the message’s original file name.

Examples

Path patternFileFromTo
{to}/{filename}acme/order1.xmlyour single organizationacme
outbox/{from}/{to}/{filename}outbox/hq/acme/order1.xmlhqacme
{filename}order1.xmlFrom settingTo setting

With {filename} alone, files sit directly in the base directory. Set From and To on the poller.

Rules

  • A placeholder fills a whole part. order_{to} is refused.
  • Each placeholder appears at most once.
  • The pattern has at most 6 parts.
  • It cannot be an absolute path, contain an empty part, . or .., or start with unroutable.
  • The poller looks exactly as deep as the pattern. It never follows symbolic links.

Who the file is from and to

  • To comes either from the poller’s To setting or from {to}, never both.
  • From comes from the From setting, from {from}, or from neither. With neither, the sender is your single organization. If you have no organization or several, the file is unroutable.
  • A captured name must be an existing party: {to} must be a partner, {from} an organization. The poller only compares names. It never uses them as paths.

Unroutable files

A file whose captured name is not a known party is unroutable. The poller does not make a message of it. Instead it:

  1. moves the file to unroutable/ below the base directory, keeping its path;
  2. writes the reason next to it, in <file>.reason.txt;
  3. raises the alert file_unroutable.

If a file with that name is already in unroutable/, the new one gets a suffix. Nothing is overwritten.

To fix it, add the missing partner or correct the folder name. Then move the file back to where the poller looks.

A file in a place the pattern does not describe, for example at the wrong depth, is left alone. The poller logs it once.

See Troubleshooting messages if files are not picked up.