implementing queue and exchanges in typescript