Skip to main content

The file that arrived at 2 a.m.

An EDI partner's overnight order file creates 23 of its 24 orders on its own; the one that fails is found at the morning check, corrected and created once, and the team makes sure the next one is seen within minutes.

The situation​

Contoso Entertainment System USA (legal entity USMF) takes orders from its trade customers through Kestrelpoint EDI, a service provider that collects the customers' purchase orders and translates them. Every night at about 2:00, Kestrelpoint drops one JSON file with the day's orders into a storage container. A Lattice file ingestion connection, KESTREL-ORDERS, pulls the file, splits it into one record per order and creates each order through the Lattice sales order operation. Customer US-001 orders items D0001 and D0002 almost every day.

Two people look after the flow:

  • Priya, integration operator, holds the Integration operator role and does the daily check at 7:30.
  • Marco, integration administrator, holds the Integration administrator role. Marco set up the connection and recovers what fails.

On Thursday night the file kestrel-orders-1105.json holds 24 orders. One of them, Kestrelpoint order KP-77120 from a store of customer US-001, carries the customer account US-001-07: the day before, Kestrelpoint's translator started adding the store number to the account for a new delivery location. There is no such customer in USMF.

Why it matters​

  • The warehouse picks from the orders created overnight. An order that is not in Finance and Operations is not picked, and the store's delivery slips a day.
  • Nobody wants to re-key the order or ask Kestrelpoint to send the whole file again: the other 23 orders already exist, and creating them a second time would duplicate them.
  • The record must be corrected without losing what the partner really sent, in case the store questions the order later.

What Priya and Marco do​

Thursday night: Lattice takes the file in, record by record​

Nobody is at work yet; the two scheduled file ingestion jobs do this part.

  1. At 2:15 the scheduled Run file ingestion job finds the file, which is older than the connection's minimum file age, and stores it as one bundle of 24 records, each Queued. The file, its bundle and its records are committed together. See File ingestion pull and segment processing.
  2. A few minutes later the scheduled Process file ingestion segments job transforms each record with the connection's Liquid template and sends it to MGCLatticeSalesOrderCaptureService.createSalesOrder, the only operation in the connection's Allowed service operations. The template names Kestrelpoint's order reference as the requestKey, so each order always gets the same request ID: a file sent twice replays the first result instead of creating a second order. 23 orders are created and their records become Processed.
  3. Order KP-77120 is refused: the customer account does not exist. The segment processor tries the record again on the next two runs of the job, no sooner than 30 and then 60 seconds after each failure, and after the third failure marks it Failed and puts it in the dead-letter queue as Parked. A file record is parked straight away because its attempts are used up, so the Lattice dead-letter retry background process does not replay it by itself.
  4. Parking an item raises the Integration item parked business event, but Contoso has not activated it, so nobody hears about it in the night.

Friday 7:30: Priya finds the failure​

  1. Priya opens System administration > Workspaces > Integration operations. Dead letters awaiting action shows 1 and Failed service calls (24 h) shows 3. See I want to see at a glance whether integrations are healthy.
  2. Priya opens Dead letters awaiting action. The Integration operations console lists one item: Source File ingestion, Service KESTREL-ORDERS (for a file record, the connection), Operation processOneSegment, Error category Data, Error code Business rule, Status Parked, and the failure message "Dispatch to the target service reported failure." Priya sees the item and its failure but not the order itself: only an Integration administrator can see a dead letter's payload. See I want to see what is in the dead-letter queue and why.
  3. That message only says the operation refused the record, so Priya opens Failed service calls (24 h). Three createSalesOrder calls from the night carry the same Request ID, Error code Document not found and Error details "Customer account US-001-07 was not found." See I want to see why a call was refused.
  4. On Inbound message inquiry, the Bundles tab shows kestrel-orders-1105.json with 24 segments. On Segments, filtered on its Bundle ID, 23 records are Processed and one is Failed after 3 processing attempts. The rest of the file is fine. See I want to follow a file from arrival to posting.
  5. Correcting and resubmitting a dead letter needs the Integration administrator role, so Priya sends Marco the dead-letter ID, the order reference and the error details. See Respond to a failed integration.

Friday 8:15: Marco works out the cause and corrects the record​

  1. Marco opens System administration > Inquiries > Lattice > File ingestion > File ingestion monitor, selects the bundle and, on Segments, the failed record. Its Request ID is the one on the three failed calls, so those calls are this record's attempts. The Log tab shows each failed attempt. See Page reference: File ingestion monitor.
  2. The order itself is right; only the account is wrong. The sales coordinator confirms that store 07 is a delivery location of customer US-001, and Kestrelpoint confirms the new translator rule.
  3. On System administration > Inquiries > Lattice > Integration operations > Dead-letter fix and resubmit, Marco selects the item. On the Payload tab, Original payload stays as Kestrelpoint sent it, as evidence. Marco pastes a copy into Edited payload and changes the account to "customer": "US-001".
  4. Marco selects Fix and resubmit and confirms. Lattice replaces the stored record with the correction, queues it again with its attempts reset, and answers "Dead letter ... was queued again. It is closed as reprocessed when the record is processed, and opened again if it fails." The item shows Requeued. See I want to act on an item an operator hands over.

Friday 8:25: the record is processed and the queue closes itself​

  1. The next run of Process file ingestion segments sends the corrected record with the same request ID as the night's attempts. Those attempts committed nothing, so this one creates the order once, and the record becomes Processed.
  2. At its next poll, within five minutes, the Lattice dead-letter retry background process finds the Requeued item whose record is now processed and closes it as Reprocessed. Nobody closes it by hand. See Lattice dead-letter retry.
  3. Priya selects Refresh on the console: the list is empty, the workspace's Dead letters awaiting action tile is back to 0, and the order for store 07 is in USMF in time for the morning's second picking run.

Afterwards: the next one is seen at once​

  1. With the system administrator (the standard Business events catalog needs that role, not a Lattice role), Marco activates Integration item parked for USMF, the legal entity the segment processor job runs in, and connects it to a Power Automate flow that posts in the integration team's channel. The message carries the dead-letter ID and the failure message, never the payload. See I want to be alerted when something needs me.
  2. Kestrelpoint changes its translator back to the plain account and sends a test file before it goes live. Priya pastes one of its orders into the File ingestion simulator with Connection ID KESTREL-ORDERS, selects Run and reads Produced contract: the order carries US-001. The sales order operation has no preview: it refuses the simulator's preview request before doing anything, and the simulator shows that step as checked. Nothing is created, and the refused preview appears on Service call log as a failed preview call. See I want to test a corrected record without posting anything.
  3. Priya keeps that order on Sample payloads for the connection. The next time Kestrelpoint changes its translation, Priya selects Replay and compares the result before the change goes live.

What changed​

  • One bad record did not hold up the file. 23 orders were created in the night with nobody at work, and the warehouse picked them on time.
  • The cause was read, not guessed. The dead letter, the failed calls and the file's records told Priya and Marco which order failed, why, and that nothing else was affected, in under an hour.
  • The order was created exactly once. The correction went through the same record and the same request ID, so there was no re-keying and no risk of a duplicate. Kestrelpoint's original stays on the dead letter as evidence.
  • The queue tidied itself. The background process closed the item once its record was processed.
  • The next failure reaches the team within minutes, and partner map changes are tried in the simulator before they go live.

For the business: deliveries kept, no duplicate orders, no manual order entry, and a record of what the partner sent and what was changed.

Try it yourself​

In a sandbox with the USMF demo data:

  1. As Integration administrator, create a file ingestion connection with New file ingestion connection that routes each record to MGCLatticeSalesOrderCaptureService.createSalesOrder, with a requestKey taken from an order reference in the file. See I want to set up a file ingestion connection and File ingestion connections.
  2. Schedule Run file ingestion and Process file ingestion segments, as in I want to schedule the Lattice jobs that are not background processes.
  3. Drop a file with two orders for item D0001: one for customer US-001 and one for an account that does not exist.
  4. Follow steps 5 to 15 above. On a development VM, where a database sync does not register the background processes, run System administration > Periodic tasks > Lattice > Run integration dead-letter retry sweep to close the item (Background processes on a development VM).