How to build a blocking Aeron based API¶
Problem¶
You want to provide an API that hides the asynchronous nature of Aeron.
Solution¶
Poll the subscription within a while loop, checking a flag indicating if the result is returned. If set, return the result. You will need to construct a FragmentHandler
which sets the flag and captures the result.
Sample¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|
Discussion¶
This is absolutely terrible for performance. Try to keep to an asynchronous API.