A Priority Queue Based on Message Priority and Time Elapsed

Problem:

The aim is to design a custom queue that will pop out a message with the highest priority. Each input message has an already assigned priority value, although this isn’t a fixed value. The priority of each message is incremented after a fixed amount of time has passed.

Solution:

Let’s assume that there are a total of 5 different priority levels. 1 to 5, with 1 being the lowest and 5 being the highest. For every 10 minutes a message spends inside the queue, the priority is bumped up by 1 unit. The maximum priority value that can be assigned is 5. In case two elements have the same priority, the messages that have spent the longest in the queue should be popped out first. https://goo.gl/9p8HQn #DataIntegration #ML

Subscribe To Newsletter

Sign up for my newsletter and get the latest technology news

2019 © Craig Brown PhD. All rights reserved.