---
# System prepended metadata

title: ' Live coding task: queue processor '

---

# Live coding task: queue processor 

At Topsort we ingest thousands of events per second we use to attribute products in campaigns. These are then used to create billing and performance reports

The impression event looks something like:

```json
{
    "user": "018fbf24-1711-7c5d-b137-c47e0c4f0b20",
    "impression": "018fbf24-63d2-7194-a781-6fc724f72945",
    "product": "myproduct"
}
```

- User: the unique user that viewed a product
- Impression: a unique representation of the view 
- Product: what product id was shown


## Task

Build a queue in Go that at a minimum supports put, get and peek. Also, use get to process the data structure and output a summary with the following requirements:

- create an interface that allows us to peek into the queue, add to it and take from it. it should be able to generate data that adds to the queue
- after a job has been retrieved from the queue, assumed it has been processed and remove it
- build a job that processes items either one by one ("get") or implement a batch processor ("mget")
- after all jobs have been processed, write a summary of unique users and total impressions per product

## Restrictions / guidelines

- Use any open source framework, component library or template starters can be used to achieve the task. The queue / processor can use libraries but not entire services like nats, kafka or rabbitmq.
- Feel free to use google, chatgpt or anything else that you usually go to for work.
