# ApiQueueService

**Type:** injectable



Service class for managing and processing a queue of API requests.

This service provides functionality to add, remove, process, and manage HTTP requests stored in a queue.
It enables sequential or bulk processing of requests, ensuring controlled execution and handling of API calls.
The service methods offer features like processing individual items, processing all items in the queue either
sequentially or all at once, and removing items from the queue. Each method is designed to handle specific aspects
of queue management and processing, with attention to details like order of execution and error handling.

Usage of this service is ideal in scenarios where API requests need to be managed in a queue structure, allowing
for controlled execution and monitoring of these requests.

```html
// Adding a new item to the queue
apiQueueService.addQueueItem({ id: 'item124', method: 'POST', uri: '/api/data', payload: {...} });
```
// Processing a single item from the queue
apiQueueService.processQueueItem('item123').subscribe(result => {
  console.log('Processed item 123 with result:', result);
});

// Processing all items in the queue in sequential order
apiQueueService.processAllQueueItemsSequential(false).subscribe(results => {
  console.log('Processed all items in descending order of their timestamp:', results);
});

// Removing an item from the queue
apiQueueService.removeQueueItem('item123');

// Processing all items in the queue and continuing on error
apiQueueService.processAllQueueItems(true).subscribe(results => {
  console.log('Processed all items in the queue with continuation on errors:', results);
});

