Pages

Tuesday, October 15, 2013

A simple, pseudo-explanation of how AIF works, intended for a developer who wants the gist of the functionality

This is a StackOverflow response that I gave, but I thought it might be good for a blog post as well.  It explains the "gist" or central idea of how the AIF works from a programmers view, touching on how AifDocumentLog, AifQueueManager, AifGatewayQueue, AifMessageLog, etc get populated and used.

There are 4 main AIF classes, I will be talking about the inbound only, and focusing on the included file system adapter and flat XML files.  I hope this makes things a little less hazy.


  1. AIFGatewayReceiveService - Uses adapters/channels to read messages in from different sources, and dumps them in the AifGatewayQueue table
  2. AIFInboundProcessingService - This processes the AifGatewayQueue table data and sends to the Ax<Document> classes
  3. AIFOutboundProcessingService - This is the inverse of #2. It creates XMLs with relevent metadata
  4. AIFGatewaySendService - This is the inverse of #1, where it uses adapters/channels to send messages out to different locations from the AifGatewayQueue



AIFGatewayReceiveService (#1):

So this basically fills the AifGatewayQueue, which is just a queue of work.  It loops through all of your channels and then finds the relevant adapter by ClassId.  The adapters are classes that implement AifIntegrationAdapter and AifReceiveAdapter, if you wanted to make your own custom one.  When it loops over the different channels, it then loops over each inbound "message" waiting to be picked up and tries to receive it into the queue.

If it can't process the file for some reason, it catches exceptions and throws them in the SysExceptionTable [Basic>Periodic>Application Integration Framework>Exceptions].  These messages are scraped from the infolog, and the messages are generated mostly from the receive adapter, which would be AifFileSystemReceiveAdapter for my example.



AIFInboundProcessingService (#2):

So this is processing the inbound messages sitting in the queue (ready/inprocess).  The Classes\AifRequestProcessor\processServiceRequest does the work.

From this method, it will call:

  • Various calls to Classes\AifMessageManager, which puts records in the AifMessageLog and the AifDocumentLog.
  • This key line: responseMessage = AifRequestProcessor::executeServiceOperation(message, endpointActionPolicy); which actually does the operation against the Ax<Document> classes by eventually getting to AifDispatcher::callServiceMethod(...)
  • It gets the return XML and packages that into an AifMessage called responseMessage and returns that where it may be logged.  It also takes that return value, and if there is a response channel, it submits that back into the AifGatewayQueue




AifQueueManager is actually cleared and populated on the fly from the form and other areas by calling AifQueueManager::createQueueManagerData();

No comments:

Post a Comment