feat:实现动态响应处理
This commit is contained in:
parent
eaf582e12e
commit
de7cf255b7
@ -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());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user