mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-10-05 06:36:55 +01:00
57 lines
No EOL
1.3 KiB
AL
57 lines
No EOL
1.3 KiB
AL
table 50112 "Queued Export Bad"
|
|
{
|
|
DataClassification = CustomerContent;
|
|
|
|
fields
|
|
{
|
|
field(1; "Entry No."; Integer)
|
|
{
|
|
AutoIncrement = true;
|
|
}
|
|
field(2; Payload; Text[250])
|
|
{
|
|
}
|
|
}
|
|
|
|
keys
|
|
{
|
|
key(PK; "Entry No.")
|
|
{
|
|
Clustered = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
codeunit 50112 "Queued Export Worker Bad"
|
|
{
|
|
TableNo = "Job Queue Entry";
|
|
|
|
trigger OnRun()
|
|
var
|
|
QueuedExport: Record "Queued Export Bad";
|
|
Client: HttpClient;
|
|
Content: HttpContent;
|
|
Response: HttpResponseMessage;
|
|
begin
|
|
if not QueuedExport.FindFirst() then
|
|
exit;
|
|
|
|
Content.WriteFrom(QueuedExport.Payload);
|
|
Client.Post('https://example.local/exports', Content, Response);
|
|
if not Response.IsSuccessStatusCode() then
|
|
Error('Export failed with HTTP status %1.', Response.HttpStatusCode());
|
|
|
|
// If this local step fails, the external export exists but this row is retried.
|
|
UpdateLocalStatus();
|
|
FinalizeExport(QueuedExport);
|
|
end;
|
|
|
|
local procedure UpdateLocalStatus()
|
|
begin
|
|
end;
|
|
|
|
local procedure FinalizeExport(var QueuedExport: Record "Queued Export Bad")
|
|
begin
|
|
QueuedExport.Delete();
|
|
end;
|
|
} |