none
Filtering infinite sequence and stopping when all elements on a list have been mentioned

    Question

  • Hi All

    Im very new to RX... And C#.

    I need behaviour like a bingo game. Im observing a sequence of strings from an observable. I select elements from the sequence that are contained in a list. I need my query to finish when all elements in the list have been mentioned once.

    The setting is a parallel computing setup. I have a number of worker processes that get assigned small subtasks round robbin through a queue. One "job" consists of several subtasks.  When a subtask has completed a message is put on a queue and taken off as part of the infinite sequence.

    I want to make a query that returns (OnCompleted) when all subtasks in a job have been completed.

    Makes sense?

    So far I have something like:

    

    from subtaskid in subtaskidsequence

    where job.subtaskList.Contains(subtaskid)

    select subtaskid;

    But it does not complete once all elements in subtaskList have been mentioned on the queue. What do you propose?

    Wednesday, May 25, 2016 7:24 PM