我知道在Reactor3.x中不推荐使用EventBus,建议的解决方案是ReplayProcessor.我已阅读https://github.com/reactor/reactor-core/issues/375.但这里的代码太草稿了.我创建了一个演示项目来证明这个想法.有人可以发表一些意见吗?
======== Application.java
package hello;
import org.reactivestreams.Subscription;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import reactor.core.publisher.Flux;
import reactor.core.publisher.ReplayProcessor;
import reactor.core.publisher.BaseSubscriber;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
@Configuration
@EnableAutoConfiguration
@ComponentScan
public class Application implements CommandLineRunner {
private static final int NUMBER_OF_QUOTES = 10;
@Bean
ReplayProcessor createReplayProcessor() {
ReplayProcessor<MyEvent> rp = ReplayProcessor.create();
Flux<MyEvent> interest1 = rp.filter(ev -> filterInterest1(ev));
Flux<MyEvent> interest2 = rp.filter(ev -> filterInterest2(ev));
interest1.subscribe(new BaseSubscriber<MyEvent>() {
@Override
protected void hookOnSubscribe(Subscription …
Run Code Online (Sandbox Code Playgroud) 我使用邮递员6.0发送http请求。为了发送请求,我使用请求前脚本获取令牌并将其放入环境中,以便在后续请求中使用它。以下脚本无效,因为未发送正文。有什么事吗?
const getTaxAccessToken={
url: 'http://dev.xxx.com:4001/api/v1/portal/account/tax-login',
method: "post",
body: {
'loginIdentity': 'admic',
'password': 'abc123'
},
header: {
'Content-Type': 'application/json'
}
};
pm.sendRequest(getTaxAccessToken, function (err, response) {
console.log("get accesstoken");
console.log(response.access_Token);
pm.environment.set("taxAccessToken", response.access_Token);
});
Run Code Online (Sandbox Code Playgroud) 我是docker的新手,对dockfile有一个简单的问题.我们可以在dock文件中编写入口点和CMD.似乎在创建容器期间执行入口点.并且在启动容器期间执行CMD.这是真的?
我在Mac中使用以下命令替换字符串。在这里,我有一个关于-print0的问题。它有什么用?
find skeleton/src/IO.Swagger/Controllers -name '*.cs' -print0| xargs -0 sed -i "" "s/namespace IO.Swagger.Controllers/namespace Abc.GroupA.TableLocalService.Controllers/g"
Run Code Online (Sandbox Code Playgroud)