Skip to main content

Dispatch

A partner system usually has only one outlet. "Kessler Logistik" reports pickup, transport, delivery and failed delivery — but all through the same queue, and outwardly one message looks like the other. On your side, these are four different jobs that update four different fields in the delivery.

A route of the type Dispatch fetches the messages, looks at each one and passes it on to the route that is responsible for it. The transferring is done by the target routes — what sets a dispatch route apart from a transferring route is described under Routes.

One inbox, several responsible routes​

"Statusmeldungen Kessler" is the dispatch route in the example. Every ten minutes it fetches from the queue whatever has accumulated, and dispatches to four target routes:

What the message saysWhere it goes
pickedAbholung Kessler
in_transitTransport Kessler
deliveredZustellung Kessler
failed or returnedFehlzustellung Kessler

The four target routes are ordinary routes with their own mapping and their own steps. "Abholung Kessler" sets the delivery status to ABGEHOLT and enters the pickup time, "Transport Kessler" writes the last known location.

A dispatch route always fetches on its own. Kessler places messages in the queue, and Xchange looks there. What prompts it to do so is a trigger, as with any other route.

The first rule that matches​

The dispatch is set up as a list of rules on the Dispatch tab, and the order is part of what it says. Xchange checks from top to bottom and stops at the first rule that matches — it passes over the others.

A rule consists of two parts:

  • the condition — a field of the message, a comparison, a value. Several conditions can be combined with AND and OR; the fourth Kessler rule uses this and catches failed and returned together.
  • the targets — one or several. If a rule with two targets matches, the same message goes to both.

A rule without any condition matches everything. That is allowed and sometimes intended; all rules below it then remain unreachable, however.

Four dispatch rules one below the other, each with condition and target route.

What makes a target route​

For a rule to be able to point to a route, the route has to be built for it:

  • Its data origin is the Dispatch input. That way it says that it is being supplied.
  • Its only trigger is the message that arrives — without a schedule of its own and without an event.
  • It is a transferring route. A dispatch route cannot be the target of another one.
  • It hangs on the same connection as the dispatch route. The selection offers only routes of this connection.

Every target route that is matched gets its own run. A message that goes to two targets thus creates two runs — in the run overview they appear side by side, each with its own outcome. One can fail while the other goes through.

When no rule matches​

Below the rule list it says what happens then: Otherwise — if no rule matches. There are exactly two settings.

SettingWhat happens to the message
SkipThe message counts as done without further processing. Right when the partner system sends along things that are irrelevant to you.
Manual reviewThe message lands in clarification and waits for a decision. Right when every message is supposed to mean something.

If the list contains a rule without a condition, the selection is grayed out and Unreachable appears next to it: when a rule matches everything, the otherwise case is ruled out.

With Manual review, you notice kinds of messages for which there is no rule yet. In the example, the dispatch is set to Manual review, and on October 8 at 9:05 AM a message with the status customs_hold came in for the shipment KS-778102 — customs inspection, a fifth kind that did not exist at the time of the setup. All four rules pass it by. The job has been in clarification for seven minutes, with the cause No dispatch rule. What happens to it there is described under Clarification.

What is decided elsewhere​

  • What is written to the delivery is defined in the target route — see Mapping.
  • Whether the message is readable at all shows in the target route. The dispatch looks into the message to check the condition; it is evaluated only there.
  • From when on a new rule takes effect is decided, as with every change, by the activation — see Configuration Snapshots.

See also​