- Comment out the runas method on AifOutboundProcessingService.runAsUserInPartition method and replace with a direct call to processAsUser method.
 
/*
// runAs currentUser and process all messages in the container.
new RunAsPermission(runAsUserId).assert();
// BP deviation documented
runas(runAsUserId,
 classnum(AifOutboundProcessingService),
 staticmethodstr(AifOutboundProcessingService, processAsUser),
 messageIdContainer,
 runAsCompany,
 '',
 runAsPartition);
// Revert the permission
CodeAccessPermission::revertAssert();
*/
AifOutboundProcessingService::processAsUser(messageIdContainer);
Important: You have to run the code on the same company and partition specified on runAsCompany and runAsPartition parameter.
- Comment out or o skip execution this line of code on AifDispatcher.dispatchOperation method
 
//new AifDispatcherPermission().demand();
For process the message queue use the new AifOutboundProcessingService().run() method