官术网_书友最值得收藏!

Application configuration

As we do not use the Publish-Subject approach and Spring's @EventListener annotation, we do not depend on Async Support, so the application configuration becomes simpler:

@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}

As we can see, this time we do not need to enable Async Support using the @EnableAsync annotation, and we also do not need to configure Spring's Executor for event handling. Of course, if required, we may configure a RxJava Scheduler for fine-grained thread management when processing reactive streams, but such a configuration would not depend on Spring Framework.

In turn, we do not need to change the code for the UI part of the application; it should work the same way as before. Here, we have to highlight that with the RxJava-based implementation, the temperature sensor is not probed when nobody listens. Such behavior is a natural consequence of the fact that reactive programming has a notion of active subscription. The Publish-Subject-based implementations do not have such properties, and as such are more limited.

主站蜘蛛池模板: 江川县| 响水县| 突泉县| 米易县| 百色市| 苍南县| 林西县| 阳原县| 洪江市| 舞阳县| 申扎县| 慈利县| 乌拉特前旗| 罗源县| 宁强县| 高邑县| 化隆| 湘阴县| 万盛区| 平顶山市| 甘德县| 邯郸市| 吉林市| 福泉市| 德州市| 河北区| 绥芬河市| 连江县| 涟源市| 和平区| 澄江县| 双城市| 台安县| 夹江县| 衡山县| 微山县| 麦盖提县| 小金县| 内乡县| 察雅县| 曲阜市|