API Programming
There exists client application (I am) and application gateway which has some API.
I have three methods to use these API. Transaction, Query and Subscribing for Broadcast.
I have the following statements that I don't know how to do.

The following sequence of actions must by performed by the client application in order
to synchronize the query (T1 Type) answer with Type A1 and Type B1 Broadcasts.
(T1, A1 and B1 are API in application gateway)
T1 Type provides the baseline of information for the A1 and B1 Type broadcasts.

(1) Start subscribing for Type A1 and Type B1 broadcasts. Received broadcasts must not be
processed until step 3. The user application must keep these broadcasts in an internal queue.
How to keep them in an internal queue???? as they are reading messages and they are synchronous.

(2) Send in the T1 Type Query.

(3) When done with the T1 Type Query download of data. the user application must handle the queued Type A1 and Type B1 broadcasts.
(How to get them again??) They must be processed in the same order as they where received.
The application has the correct information at the point when all queued broadcasts have been handled.

(4) When all queued broadcasts have been processed the application can remove the usage of the internal queue. How to remove??