“Completed with discarded messages” again

Yesterday some customers told me that they were suffering from “Completed with discarded messages” in an orchestration using the sequential convoy. They asked me how to solve.
I heard from other customer about the same issue last year. I think it is the one of the most frequent problems customers encounter when they use the “convoy” for the first time.
You can find a great article about the issue, “Completed with discarded messages”, from here. The post wrote the cause of the problem into 3 categories. The case I heard yesterday could be categorized into the 2nd one, which is “Sequential convoys with non-deterministic endpoints”.
Anyway, I wrote a sample code for the customer as following:

The basic idea is very simple. The customers can insert their orchestration into “Foo Process Msg”, The listen shape of “Check Msg for preventing it from being discarded” checks the work queue again before termination. It could prevent the message, which has arrived while processing the customer’s logic, from being discarded. And you can find the sample code here.

Thanks,
Young