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

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.

主站蜘蛛池模板: 邵阳市| 华宁县| 尼玛县| 洪洞县| 杭锦旗| 隆林| 麦盖提县| 施甸县| 佳木斯市| 塔城市| 会理县| 石屏县| 库车县| 全南县| 竹北市| 宁陕县| 常山县| 红原县| 曲周县| 大姚县| 吴桥县| 兰州市| 即墨市| 肃宁县| 友谊县| 岳阳县| 资源县| 石景山区| 工布江达县| 古丈县| 梁河县| 曲麻莱县| 邳州市| 宁安市| 邢台县| 伊宁市| 泾源县| 洛浦县| 陇西县| 丰宁| 新河县|