Template10: Create Template 10 Queue service

Created on 28 Jul 2016  路  5Comments  路  Source: Windows-XAML/Template10

Maybe.

backlog enhancement

Most helpful comment

The idea is a simple MSMQ.
Queue.Add(T message);
T Queue.Next();
Etc.

The reason for this is to implement the design pattern for "local queuing" of work for the sake of high-performance apps. The idea is to acknowledge to the user to intent to do the work, but to delay the work for the sake of 1) batch 2) continued responsiveness and 3) delayed for undo. I want to build a simple implementation that doesn't reinvent the wheel. Supporting most cases and allowing it to be extensible for other uses. Make sense?

All 5 comments

What does this service actually do?

The idea is a simple MSMQ.
Queue.Add(T message);
T Queue.Next();
Etc.

The reason for this is to implement the design pattern for "local queuing" of work for the sake of high-performance apps. The idea is to acknowledge to the user to intent to do the work, but to delay the work for the sake of 1) batch 2) continued responsiveness and 3) delayed for undo. I want to build a simple implementation that doesn't reinvent the wheel. Supporting most cases and allowing it to be extensible for other uses. Make sense?

sounds really good

Something like this perhaps.

public class Queue<T>
{
    public static Queue<T> Instance { get; } = new Queue<T>();
    private Queue()
    {
        // private constructor
    }

    System.Collections.Generic.Queue<T> queue
        = new System.Collections.Generic.Queue<T>();

    public event TypedEventHandler<T> Enqueued;

    public void Enqueue(T item)
    {
        Enqueue(item);
        Enqueued?.Invoke(null, item);
    }

    public event TypedEventHandler<T> Dequeued;

    public T Dequeue()
    {
        var item = Dequeue();
        Dequeued?.Invoke(null, item);
        return item;
    }
}

Not a bad idea. I'll start working on a basic implementation for testing. I'm on school holidays at the moment; it's not like I've got any better use for my time.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JerryNixon picture JerryNixon  路  8Comments

Weasy666 picture Weasy666  路  8Comments

mjmeans picture mjmeans  路  10Comments

Opiumtm picture Opiumtm  路  8Comments

JerryNixon picture JerryNixon  路  6Comments