spring - Multi-threading for reactor consumers -


i using reactor publish events throughout application , have different consumers respond events.

here reactor configuration

@configuration @enablereactor public class reactorconfiguration {      static {        environment.initializeifempty().assignerrorjournal();     }      @bean     public eventbus eventbus() {        return eventbus.config().env(environment.get()).dispatcher(environment.shared).get(); } 

i expecting default ring buffer based dispatcher used , multiple messages sent single consumer should processed in parallel. instead seems processing events in synchronous fashion. thread shared-1 used process event1 consumer1 , after completing processing of event1, same thread starts processing of event2 on consumer1.

how can achieve parallel processing in way should able send multiple events multiple consumers , events processed in parallel.

i appreciate suggestions.

this how dispatching events event bus

dispatch(reactorevents.report_request_event, "", event);  protected <t> void dispatch(string selector, string info, t event) {     eventbus.notify(selector, event.wrap(tuple.of(info, event))); } 

and here 1 of consumers

@consumer public class reportrequesthandler { ...   @selector(reactorevents.report_request_event)   @override   public void handlerequest(tuple2<string, reportrequestevent> tuple) {     reportrequestevent event = tuple.gett2();     log.debug("processing report request " + event.getid());     ....   } } 

the default ring buffer implementation single-threaded. why observing side effects have described. more detail various dispatcher choices available you, please review following link:

http://projectreactor.io/docs/reference/#_dispatchers


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -