feat:实现动态响应处理

This commit is contained in:
wangyu 2022-01-26 09:37:26 +08:00
parent eaf582e12e
commit de7cf255b7
1 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,22 @@
package com.flyfish.framework.context;
import reactor.core.publisher.Mono;
/**
* 异步上下文
* 提供当前订阅联调无缝体验
*
* @author wangyu
*/
public class ReactiveContext {
/**
* 获取上下文中的共享值
*
* @param <T> 泛型就是exchange
* @return 结果
*/
public static <T> Mono<T> get(Class<T> clazz) {
return Mono.deferContextual(ctx -> ctx.hasKey(clazz) ? ctx.<Mono<T>>get(clazz) : Mono.empty());
}
}