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

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.

主站蜘蛛池模板: 连云港市| 阿拉尔市| 信阳市| 乐至县| 柳江县| 呼伦贝尔市| 青岛市| 汉川市| 东山县| 麻江县| 泰州市| 大渡口区| 舞钢市| 龙泉市| 肇庆市| 兖州市| 望都县| 高尔夫| 临颍县| 井陉县| 凭祥市| 晋中市| 乌鲁木齐县| 揭西县| 安平县| 云梦县| 廉江市| 德江县| 岫岩| 宝山区| 从江县| 屏山县| 平陆县| 五大连池市| 独山县| 马关县| 中方县| 新兴县| 即墨市| 永济市| 堆龙德庆县|