Skip to main content

Processing Policy

The processing policy is the brain of an MPGW. It's an ordered set of rules, each made of actions, that decide what happens to every message. If handlers are "how clients reach it" and the backend is "where it goes", the policy is "what happens in between".

Rules and direction​

A policy contains rules, and each rule has a direction:

  • Request (client → server) — runs on the way in, before the backend.
  • Response (server → client) — runs on the way out, after the backend.
  • Both — runs in either direction.
  • Error — runs when something fails (covered in Module 5).

How a rule is matched​

Each rule starts with a Match action (next lesson). The policy evaluates rules top to bottom for the current direction and runs the first rule whose match succeeds. Order matters — put more specific matches above general ones.

Actions and the context pipeline​

Within a rule, actions run in sequence. Each action reads an input context and writes an output context — a named "variable" holding the message at that stage. Actions are chained by wiring one action's output context to the next action's input.

Two contexts are special:

  • INPUT — the message as it entered this rule.
  • OUTPUT — the message that will be sent on (to the backend on the request side, or to the client on the response side).

Everything in between is contexts you name. Getting the wiring right — each action consuming the previous one's output — is the most common source of beginner bugs.

Common action types (preview)​

ActionPurpose
MatchDecide whether the rule applies
AAAAuthenticate / authorise the request (Module 4)
ValidateCheck the message against a schema/WSDL
TransformRun XSLT or GatewayScript (Module 5)
FilterAccept/reject based on custom logic
RouteSet a dynamic backend destination
Results / RouteSend the message somewhere
LogEmit a log message

We examine matches and actions in detail next.

Knowledge Check

How does the policy decide which rule to run for a given direction?

What are the INPUT and OUTPUT contexts?