MSBA-342 · Lesson 4 of 12 · 21 min
Recurring integrations
▶ Video coming soon A video version of this lesson is on the way.
Henrik Salo brought the next problem to the clinic himself. Two of the fictional carriers that Cobalt Ridge used out of the Calgary warehouse, Pikeline and Faulkland, sent freight invoice files every weekday. Pikeline's file was a comma-separated export of a few hundred lines; Faulkland sent XML. Under the old system, a clerk downloaded both from the carriers' portals and keyed the totals. Henrik wanted the lines in finance and operations apps automatically, where freight reconciliation could match them against the shipments. On the outbound side, the plant scheduling tool at Hamilton still expected a nightly file of open sales order lines. Neither need was a single row or a single question. Both were files, on a schedule, in bulk.
This clinic covered the two documented ways for an outside program to move files through the data management framework without a person in the loop: recurring integrations, where finance and operations apps hold a scheduled data job and the outside program pushes or pulls files through a queue, and the data management package REST API, where the outside program drives the import or export itself. It also covered the choice between them, monitoring, and the errors that matter.
The recurring integration pattern
A recurring integration starts as an ordinary import or export project in the Data management workspace. The project defines the entity, the source format and the mapping, just as in the first clinic. Then, instead of running it by hand, an administrator creates a recurring data job from the project. The job has an ID, a recurrence (for example every fifteen minutes), a processing mode, and an authorization policy that lists the Microsoft Entra application IDs allowed to use it. The job ID is the GUID shown in the ID field on the Manage scheduled data jobs page; outside programs use it in every call.
For imports, the outside program enqueues a file by posting it to the connector endpoint with the job's activity ID and the entity name. The file is stored in blob storage and a message is queued. When the scheduled batch job runs, it picks up queued messages, imports each file through staging, and records the result. For exports, the batch job runs the export on its schedule and puts the output file in the queue, and the outside program dequeues it with a GET request, downloads the file from the returned URL, and then acknowledges it with a POST of the dequeue response body. Until a message is acknowledged, it becomes available to dequeue again every thirty minutes, which protects against a program that crashes after downloading but before processing.
# Import: Pikeline freight invoice file into the recurring job
POST https://cobaltridge-uat.operations.dynamics.com/api/connector/enqueue/%7B6A2F...%7D?entity=Freight%20invoice%20lines
Authorization: Bearer eyJ0eXAiOi...
<file bytes>
-> returns a message ID, for example 7c1e2b4a-...
# Export: open sales order lines for the plant scheduling tool
GET https://cobaltridge-uat.operations.dynamics.com/api/connector/dequeue/%7BC03B...%7D
-> JSON with CorrelationId, PopReceipt, DownloadLocation, ...
GET <DownloadLocation> (download the package)
POST https://cobaltridge-uat.operations.dynamics.com/api/connector/ack/%7BC03B...%7D
<body = the JSON returned by dequeue>Message status
Every enqueued or exported file has a message, and every message has a status. The outside program should check status rather than assume success, using the GetMessageStatus action on the data management definition groups entity, passing the message ID it received when it enqueued. Microsoft documents the following status values.
| Status | Meaning |
|---|---|
| Enqueued | The file was placed in blob storage |
| Dequeued | An outside program dequeued the exported file |
| Acked | The outside program acknowledged the exported file |
| Preprocessing | The import or export is preparing the request |
| Processing | The import or export is running |
| Processed | Completed successfully |
| ProcessedWithErrors | Completed, but some records failed |
| PreProcessingError | Failed before processing started |
| PostProcessingFailed | Failed after processing |
POST https://cobaltridge-uat.operations.dynamics.com/data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.GetMessageStatus
Content-Type: application/json
{ "messageId": "7c1e2b4a-..." }
-> "ProcessedWithErrors"
# Then find the execution and its errors
POST .../data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.GetExecutionIdByMessageId
{ "_messageId": "7c1e2b4a-..." }
POST .../data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.GetExecutionErrors
{ "executionId": "<execution ID>" }ProcessedWithErrors is the status Henrik's team would see most often, and it is easy to miss. It means the job ran and most lines arrived, but some did not. A freight invoice line for a shipment that does not exist, for instance, fails validation and stays in staging. Desmond's design for the carrier integration therefore had the Azure middleware poll for status after each enqueue and, on ProcessedWithErrors, read the execution errors and send a summary to the freight team's shared mailbox, so that the failed lines were fixed the same day rather than discovered at month end.
Housekeeping rules
A few rules from Microsoft's documentation shaped the carrier design. Files in the queue are deleted automatically after seven days, so an outside program that is down for a week loses its exports unless they are run again. In some production environments the dequeue response can return a download location with plain http in the address; the middleware should change it to https before downloading. When several packages are imported in parallel through recurring jobs or the package API, the Enhanced parallel package import option under the data management framework parameters should be turned on. Recurring integrations are not supported for on-premises deployments, which did not affect Cobalt Ridge.
Recurring jobs also need a home for errors when the outside program does not handle them. Desmond enabled the alerting options on the scheduled job so that the job's failures appeared in the action centre of the integration owner, and he set the job to process messages in order where order mattered. For freight invoices, order did not matter; for the plant scheduling export, only the latest file mattered, so the scheduling tool could safely skip older files.
The data management package REST API
The second pattern gives the outside program full control. Instead of a scheduled job, the program calls OData actions on the DataManagementDefinitionGroups entity to start imports and exports of data packages whenever it chooses. The import sequence is: ask for a writable blob URL, upload the package to it, call ImportFromPackage with the package URL, the name of an existing data project (the definition group), an execution ID, whether to execute the target step, whether to overwrite, and the legal entity; then poll the execution status until it finishes. The export sequence calls ExportToPackage with the definition group, a package name, an execution ID, whether to rerun and the legal entity, polls status, and then asks for the URL of the exported package and downloads it.
POST .../data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.GetAzureWriteUrl
{ "uniqueFileName": "cutover-warranties-01" }
-> { "BlobId": "...", "BlobUrl": "https://...blob.core.windows.net/..." }
PUT <BlobUrl> (upload the package zip)
POST .../data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.ImportFromPackage
{
"packageUrl": "<BlobUrl>",
"definitionGroupId": "CR Warranty cutover",
"executionId": "",
"execute": true,
"overwrite": true,
"legalEntityId": "crca"
}
-> execution ID
POST .../data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.GetExecutionSummaryStatus
{ "executionId": "<execution ID>" }
-> "Executing" ... "Succeeded" | "PartiallySucceeded" | "Failed"Cobalt Ridge would use the package API for exactly one job: the cutover load of historic warranties from the old system, which Kiri Langford planned to run three times in rehearsals and once at go-live in 2027. The migration team's script would upload a package of about eleven thousand warranties per company, start the import, poll every thirty seconds, and stop the cutover runbook if the result was anything but Succeeded. The package API suited this because the team wanted to start the load at a precise moment in the runbook, not wait for a schedule.
Choosing between the two
Microsoft's guidance compares the patterns on scheduling, file formats, transformation and the client's responsibilities. Desmond summarized it for the register.
| Question | Recurring integrations | Package REST API |
|---|---|---|
| Who schedules? | Finance and operations apps (recurring data job) | The outside program |
| File types | Single files or packages | Packages only |
| Typical direction | Ongoing feeds in and out | Loads and exports started on demand |
| Queue and acknowledge | Yes, with automatic redelivery | No queue; the program polls status |
| Setup in the application | Project, recurring job, authorization policy | Project (definition group) only |
| Cobalt Ridge use | Carrier freight invoices; nightly scheduling export | Warranty cutover load |
Both patterns are designed for volume, and both are exempt from the user-based service protection limits that apply to OData and custom services, because they go through the data management framework rather than the interactive endpoints. That does not mean they are free. Large imports still consume batch and database capacity, which is why lesson 11 looks at scheduling them away from busy hours and turning on set-based processing where the entity allows it.
Where the middleware fits
Neither carrier would call Cobalt Ridge's connector endpoints directly. Pikeline and Faulkland drop files on their own portals and know nothing about Microsoft Entra ID or job IDs. Something had to fetch the files, reshape them if needed, enqueue them, and watch the result. That something is usually called middleware, and at Cobalt Ridge it would be an Azure Logic Apps workflow owned by the partner's integration team, with an Azure Function for the few transformations that needed code. Desmond drew the boundary carefully in the register: the middleware owns fetching, reshaping, retrying and alerting; finance and operations apps own the entity, the project mapping and the business validation.
The reshaping question came up immediately with Faulkland's XML. The data management project could map an XML file whose elements matched the entity's staging fields, but Faulkland's file nested charges inside shipments inside an invoice, three levels deep. There were three options: transform the XML in the middleware into the flat shape the entity expected, apply a transformation in the data project itself, or build a custom entity with the nested shape. Desmond chose the middleware transformation. It kept the entity standard, kept carrier-specific logic out of the application, and meant that if a third carrier joined in 2027 only the middleware would change. Pikeline's comma-separated file needed only a column rename, which the project's field mapping handled directly.
Designing the freight invoice job
The freight invoice job ended up with these settings. The entity was the standard freight invoice lines entity, extended with one field for the carrier's own invoice reference so that lines could be traced back to the carrier's portal. The recurring job ran every fifteen minutes on weekdays between six in the morning and eight in the evening, local time at the warehouse, because files never arrived outside those hours and a quiet schedule kept batch capacity free for the night. The authorization policy listed one application, the Logic Apps managed identity's app registration. The integration user was CR-INT-FREIGHT, with a role that could import freight invoice lines and nothing else. And the job processed messages in the order they arrived, because a carrier sometimes sent a correction file minutes after an original.
Desmond then wrote three test cases for the UAT sandbox. A clean Pikeline file of two hundred lines should reach Processed with two hundred lines in the target. A Faulkland file with one line referencing an unknown shipment should reach ProcessedWithErrors, with one line in staging and an email in the freight team's mailbox within twenty minutes. And a file enqueued with the wrong entity name should be rejected at enqueue time with an error that the middleware logged. Roshni Adebayo-Kerr, the shift supervisor who would field questions from the freight clerks, sat in on the tests so she would recognize the email when it arrived.
Monitoring the jobs over time
Recurring jobs tend to fail quietly. A carrier changes a column header, a certificate expires, or a sandbox refresh copies production's job IDs into UAT and the middleware starts sending files to the wrong place. The data management workspace shows job history, and the Manage scheduled data jobs page shows when each job last ran. Desmond added a weekly check to the support runbook: compare the number of messages processed per job with the week before, and investigate any job whose count fell to zero. It was a crude check, but it would have caught every recurring-integration failure he had seen in his years at the partner.
The end of the nightly scheduling file
The plant scheduling export was a recurring integration that Desmond hoped to retire. The tool did not need every open order every night; it needed to know when an order for a configured pump was confirmed or changed, so that it could replan the shop floor. A full nightly file was an inefficient way to say that, and it left the plant planning on data up to a day old. The register now said: keep the nightly export through go-live as a safety net, and replace it with a business event in the first quarter of 2027. The next clinic would build that event.
Worked problem
Diagnosing a missing export
The plant scheduling tool team reports that the export file was missing on two mornings in a row. The recurring job ran successfully both nights. What should Prudence check?
Show solution
- Check the message status of the two exports. If the status is Dequeued but not Acked, the scheduling tool downloaded the file and did not acknowledge it, perhaps because it crashed during processing.
- Unacknowledged messages reappear for dequeue after thirty minutes, so the tool may have dequeued an older message again instead of the newest.
- If the status is Processed but never Dequeued, the tool did not call dequeue at all; check its credentials and the authorization policy on the recurring job.
- If the files are older than seven days, they will have been deleted from blob storage and the export must be run again.
Answer: Use message status to locate the failure: missing acknowledgement, missing dequeue, or expired blobs. Fix the client's acknowledgement or authorization, then rerun the export if needed.
Common mistakes
MistakeTreating a successful enqueue as a successful import.
InsteadPoll message status and read execution errors; ProcessedWithErrors means some lines failed.
MistakeDownloading exports without acknowledging them.
InsteadSend the acknowledgement after processing; unacknowledged messages reappear every thirty minutes.
MistakeLeaving the authorization policy of the recurring job empty.
InsteadList the Entra application IDs that may use the job and enable them.
MistakeRunning parallel package imports without the enhanced option.
InsteadTurn on Enhanced parallel package import in the data management framework parameters.
Summary and key terms
- Recurring integrations pair a scheduled data job in the application with enqueue, dequeue and acknowledge calls from an outside program.
- Message status values such as Processed, ProcessedWithErrors and Acked show how each file fared.
- Unacknowledged exports reappear after thirty minutes; queued files are deleted after seven days.
- The package REST API lets an outside program start package imports and exports and poll their status.
- Choose recurring integrations for ongoing feeds and the package API for loads started on demand.
- Recurring data job
- A scheduled data management job that processes files enqueued or exports files for dequeue.
- Enqueue
- To post a file to a recurring data job for import.
- Dequeue
- To retrieve an exported file from a recurring data job.
- Acknowledge
- To confirm to the job that an exported file has been processed.
- Activity ID
- The GUID of a recurring data job used in connector endpoint URLs.
- Package REST API
- OData actions that let a program import and export data packages on demand.
- Definition group
- The data project named in package API calls.
Practice problems
Work each problem on paper first, then reveal the answer to check.
Which page shows the ID that an outside program uses in enqueue calls?
Show answer
Manage scheduled data jobs, in the ID field of the recurring job.
Why did Cobalt Ridge choose the package API for the warranty cutover load?
Show answer
Because the runbook must start the load at a precise moment and wait for its result, not wait for a schedule.
What should middleware do if a dequeue response contains an http address in production?
Show answer
Change the address to https before downloading the file.
Lesson quiz · 5 questions
Score 60% or more to complete this lesson.
Create a free account to save your progress, take quizzes and earn a certificate.