Interaction services provide interaction between applications or users. In our sample scenario, we have our service that provides interaction between two applications without the need of a third software in between. For this purpose, we have a DocumentValidity service, and we call it a notification service, which receives the notification from one service and processes it to another within the same Regulatory Affairs context (department):
Let's view the simple code for our sample notification service:
/// <summary>
/// This API gets the notifications from the DB Documents
Validation Notification service.
/// Usage: - GET api/DocumentValidity/notify?employeeId=2&docid=1
/// Type: Interaction Service
/// </summary>
/// <param name="employeeId"></param>
/// <param name="docId"></param>
/// <returns></returns>
[HttpGet("Notify")]
public IActionResult Notify(int employeeId, int docId)
{
soaContext = new SOAContext();
soaContext.Initialize();
//Start document validation/expiry process by
invoking DocumentSubmitter to Authorities depending
on the type of the document
DocumentSubmitterProxy.ProcessDocumentSubmission(
employeeId, docId);
soaContext.Close();
return new OkResult();
}
Note that our notification service gets called by another SOA service (the preceding code), and this service, after receiving the notification, calls another service creating a service composition as a service choreography.