To have AIF import and export message, you have to have 4 batch tasks running (all about it here on TechNet). However, when developing, it is inefficient (and also tad tedious) to wait for those batches.
Here are two jobs to run inbound and outbound messages manually, so you don’t have to wait for the batches to pick them up.
Inbound:
static void KlForrunAIFInbound(Args _args)
{
;
// read the messages
new AifGateWayReceiveService().run();
// process the messages in queue
new AifInboundProcessingService().run();
info("done");
}
{
;
// read the messages
new AifGateWayReceiveService().run();
// process the messages in queue
new AifInboundProcessingService().run();
info("done");
}
Outbound:
static void KlForrunAIFOutbound(Args _args)
{
;
// process messages in queue
new AifOutboundProcessingService().run();
// send messages
new AifGateWaySendService().run();
info("done");
}
{
;
// process messages in queue
new AifOutboundProcessingService().run();
// send messages
new AifGateWaySendService().run();
info("done");
}
Ofcourse, you can put this code in classes, or combine them so they are executed together. Because inbound messages can trigger outbound messages, it’s better to process the inbound messages before the outbound messages.