Lifecycle Actions (archive, fail, print)

Karl Falconer · Updated

These actions don’t transform an order — they take it out of the normal flow. archive puts a record away cleanly; fail halts it with an error; print writes a debug message you can see in the trace harness.

archive

archive order

Archives the record. It’s no longer active in DropStream’s processing but stays available for reference and reporting. Use this for orders that are intentionally not going to be fulfilled — test orders, training orders, deliberate cancellations.

when
  order.notes contains "TEST"
then
  archive order
end

Archive is terminal — once a record is archived, no further rules run against it.

fail

fail order with "Missing required shipping address"

Marks the record as failed and attaches a human-readable error message. Failed orders show up in the Errors queue in the DropStream UI, where someone can investigate, fix the underlying issue, and retry.

The with "..." part is required and should describe what went wrong:

when order.shipping_address.country is blank then
  fail order with "Missing shipping country for order " & order.id
end

when order.subtotal <= 0 then
  fail order with "Order has zero or negative subtotal"
end

A good error message tells the operator:

  • What’s wrong — name the missing field, the bad value, or the unexpected condition.
  • What to do — explicit if possible. “Set the shipping country in the source system and re-import.”
  • Where it came from — include identifying info like order.id or order.external_id if relevant.

Like archive, fail is terminal — no further rules run against a failed record.

Combinations

These actions usually appear with a condition — they’re not run unconditionally. Common patterns:

Validate, then fail:

when order.shipping_address.country is blank then
  fail order with "Missing shipping country"
end

Archive a class of orders:

when
  order.notes contains "TEST"
  or order.notes contains "DO NOT FULFILL"
  or order.customer_email ends_with "@example.com"
then
  archive order
end

Tips

  • fail is louder than reject. reject silently removes a record from processing; fail flags it for human attention. Use fail when something is genuinely wrong and a person needs to see it.
  • Archive non-fulfillable orders, don’t fail them. Test orders aren’t errors. archive keeps them out of processing without filling the error queue.
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.