I have started to look at ReactiveX and can't figure out if it would be a good fit for a problem I'm trying to solve because either I don't now enough about ReactiveX or it doesn't have what I need.

Let's say that I'm constantly receiving messages that could be of 20 different types. All messages should be first saved to a database. Then I will need some further analysis. I am interested in types A, B, C and D coming in that order (doesn't have to be one after another). When message A comes that should be considered as start of a process that I need to trigger. Then I should wait for message B (any other message type can arrive while waiting) to arrive and to execute step in the process. After message B I wait for message C and execute step in the process. Then I wait for message D which marks the end of the process. Then I need to start over and wait for message A which starts the new process.

I am using .NET, but code from any platform would probably be ok to figure out how (or if) this can be done.

**UPDATE:** Giving some more context

Using @Enigmativity sample code I'll try to expand this question a little bit. Messages are produced by devices. So let's assume that in "A1,B2,B1,C1, F3,...." stream first letter is message type and the number is ID of a device. So messages A, B, C and D needs to be of a same device to be considered as a match. Server always gets all the messages because device will repeat them until it gets confirmation. This is what **single** device can produce (stream can contain messages mixed up messages from all devices):

A1,B1,H1,F1,A1 - here device restarted before completing whatever it's doing so first A1,B1 should be ignored and we now start over waiting for A, B, C and D.

A1,B1,C1,B1 - this can not happen. A1 will always come before B, C or D. It may not get to D sometimes, but then it will start over.