'Pause and resume Observable Stream and only emit custom messages from other stream during that pause with RxJS

I have a hot observable emitting messages continuously. I need to pause it with an API REST endpoint like an actuator /messages/pause, and resume it with other API REST endpoint like /messages/resume. During the pause time I need to allow with other API REST endpoint to emit a message like the original observable /messages/custom.

It is possible to pause the main observable stream during that interval (pause-resume) but not stop observing the mocked messages events, and continue/restore the main observable stream after resume it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source