Polling
Implementation
Sequence Diagram
You can use polling strategy in order to implement TrustFactor. Your implementation would be something like this:
Transaction diagram with Polling strategy - Fig. 1
Infrastructure
Infrastructure diagram with Polling strategy - Fig. 2
Pros and Cons
This strategy has very low performance because the user will be polling services every X seconds in order to retrieve updates. Your infrastructure is safe and protected because all ingress communications goes through a Web Application Firewall.
Difficulties
You will have to keep in mind an implementation where you have multiple backend replicas and each request will be handled by a different replica:
- The authentication creation
- The callback from TrustFactor's services
- The polling from the user
You won't be able to keep data in application's memory since the next request might be handled by a different replica. You will need to use an external storage to help keep all replicas in-sync like Redis and pass information from one replica to another.