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

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.

主站蜘蛛池模板: 湘潭县| 密云县| 泰宁县| 图片| 错那县| 葫芦岛市| 大荔县| 桦南县| 马关县| 金坛市| 蕲春县| 民和| 镇安县| 顺昌县| 吉木萨尔县| 资溪县| 和静县| 和静县| 深水埗区| 额尔古纳市| 洛阳市| 探索| 高邑县| 玉环县| 万载县| 婺源县| 孙吴县| 玉田县| 湟源县| 保亭| 重庆市| 栾城县| 玛多县| 嘉峪关市| 偏关县| 霍林郭勒市| 蒲城县| 汝城县| 阿拉善盟| 澜沧| 习水县|