Queue Implementation for third party api
I think this is what you want: 

'If any failure occurs, you can revert the item back to queue to process that again'

The queue API of Drupal 8 which is known as Queue Worker 

http://www.tothenew.com/blog/how-to-implement-queue-workerapi-in-drupal-8/