bennidi / mbassador

Powerful event-bus optimized for high throughput in multi-threaded applications. Features: Sync and Async event publication, weak/strong references, event filtering, annotation driven
MIT License
955 stars 146 forks source link

Add event bus pause/resume support. #131

Closed bgroenks96 closed 7 years ago

bgroenks96 commented 8 years ago

See PubSubPauseSupport javadoc comments for API documentation.

Notes on resume() methods: PubSubPauseSupport.resume() takes a single parameter, an enum type FlushMode that determines the behavior or subsequent calls to pause while the queue flush is in progress. The default setting is FlushMode.ATOMIC, which will engage a lock that causes calls to 'pause()' to block until resume returns. FlushMode.NONATOMIC will cause 'resume()' to flush until either the queue is empty OR 'pause()' is called again.

AsyncPubSubPauseSupport defines another enum PublishMode which differentiates between synchronous or asynchronous publishing of events on resume. The class is implemented by AbstractPauseSyncAsyncMessageBus (subclass of pre-existing AbstractSyncAsyncMessageBus) from which MBassador now inherits.

bgroenks96 commented 8 years ago

See #122 for discussion on the code design for this PR.

bgroenks96 commented 8 years ago

@bennidi Update on this?