How to use Reactor to dispatch events to multiple consumers and to filter events based on event data? -


I am evaluating the reactor if it would be appropriate to dispatch the framework inside my spring / enterprise application .

First, consider the scenario in which you have an interface A and the solid event class B , C and on. I want to send concrete events to many consumers i.e. the supervisors are registered for the global reactor example during those bean post processing, however, you can dynamically register them. In most cases a manufacturer has many Sending events to consumers at a higher rate.

I have sent the code to use selector s, that is, ClassSelector . The correct event type for the right consumers works well.

  reactor reactor = ... b event = ... consumer & lt; Events & lt; B & gt; & Gt; Consumer = ... // Registration is used to cancel the subscription later on & lt ;? & Gt; Registration = Reactor (T. (Event .getClass ()), Consumer);  

Inform the event as a key,

  B event = ... reactor.update (event.getClass (), event.wrap (accident));  

However, I am thinking that is it suggested to send these events efficiently?

Secondly, I was wondering if it is possible to filter out events based on this incident data? If I understand correctly, then selector s is just to inspect the key. I am not discussing the event titles here but for domain specific object properties. I was thinking of using stream and Stream.filter (Predicate P) but the reactor Is it also possible to filter by using selector ? Of course I can write a representative consumer who inspects the data and if it is necessary, then it represents the registered consumers.

"post-text" itemprop = "text">

is called a helper object that helps in creating various types of underlying selector implementation. Code> PredicateSelector is very useful because it allows you to complete the control of the notification key mail. It can be a spring @ bean , an anonymous internal square, lambda, or something more simple, Predicate can be in conformity with the interface.

Alternatively, if you have your classpath, you can use it to match based on JsonPath queries.

In one of these cases, you do not need an important object if the important data is actually the domain itself inform the object bus object and as the second parameter Event & lt; Object & gt; Pass .

  MyPojo p = service.next (); Reactor.Notefei (P, event.Wipe (P));  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -