cost 233 ms
如何使用 Micrometer 配置 Spring Boot 3 和 Spring Stream(使用 RabbitMQ),在 Zipkin 中不分离跟踪 HTTP 和 MQ?

[英]How can I configure Spring Boot 3 with Micrometer and Spring Stream (with RabbitMQ) that does not separate trace HTTP and MQ in Zipkin?

我配置了一个基本的 Spring Boot with Micrometer 和 Spring Stream (with RabbitMQ)。 我想配置 traceId 可以通过 Spring Stream 传递到另一个服务中。 我知道当我使用 tryNextEmit 时它会丢失跟踪信息。 所以它会 ...

单元测试返回 401 Unauthorized on a permitted route in Spring WebFlux Security

[英]Unit test returns 401 Unauthorized on a permitted route in Spring WebFlux Security

我正在尝试测试返回对象数组的路由,但测试失败,因为它返回 Unauthorized 而不是 200 OK 我的测试 class 而ApplicationSecurityConfig class,有一个SecurityWebFilterChain Bean JUint 测试错误显示如下 java. ...

如何从 Mono 中提取 boolean 值<object>以非阻塞的方式<div id="text_translate"><p>我有一个涉及<strong>反应性</strong>和<strong>非反应性</strong>对象的验证方法。</p><pre> private boolean filterByName(String student, Mono<String> teacher) { if (student.startsWith("A")) return true; else if(teacher.startsWith("B")) return false; //however teacher is Mono<String> }</pre><p> <strong>问题:</strong>如何在不使用block或subscribe的情况下成功检查Mono<String>后返回boolean值</p><p>调用filterByName的方法用于另一个<strong>反应式</strong>方法:</p><pre> public Mono<Student> validateStudent(Student student) { return Mono.just(student).filter(this::filterByName).switchIfEmpty(Mono.error(new Exception("Validation Failed"))); }</pre><p> 请帮助我成功返回boolean而不会阻止任何Mono</p><p> 我是反应式编程的新手。 任何帮助表示赞赏。 提前致谢。</p></div></object>

[英]How to extract boolean value out of a Mono<Object> in a non blocking way

我有一个涉及反应性和非反应性对象的验证方法。 问题:如何在不使用block或subscribe的情况下成功检查Mono&lt;String&gt;后返回boolean值调用filterByName的方法用于另一个反应式方法: 请帮助我成功返回boolean而不会阻止任何Mono 我是反应式编程的新手 ...

如何在 reactor.netty 服务器的 Spring Webflux 中监控仪表

[英]How to monitor meters in Spring Webflux for a reactor-netty server

我是 Spring Boot 和 Spring Webflux 的新手。 我正在使用 Spring Webflux reactor.netty 服务器来处理 WebSocket 连接。 在最简单的意义上,这就是服务器的样子: 现在,我想监控仪表,特别是可以帮助识别背压或 memory 泄漏的仪表,如 ...

立即从两个 Monos 返回第一个发出的值,同时继续异步处理另一个

[英]Immediately return first emitted value from two Monos while continuing to process the other asynchronously

我有两个数据源,每个都返回一个 Mono: 我的应用程序的调用者正在点击 Spring WebFlux controller: 只要任一数据源成功完成其创建操作,我想立即向调用方返回成功响应,但是,我仍然希望我的服务继续处理其他 Mono stream 的结果,以防遇到错误, 所以它可以被记录下来。 ...

如何获取数据,然后使用 Spring Webflux 从数据库中删除它?

[英]How to Fetch Data and then Delete it from database using Spring Webflux?

删除操作不起作用。 我如何获取数据然后以功能方式删除它? 代码成功运行,但未删除数据库中的数据。 Controller Class 用户服务 Class 存储库接口 Postgres 表警报系统=# select * 来自 tb_user; 用户名 | 用户名 | 姓名 | email | ...

Spring Reactor:以非阻塞方式添加延迟

[英]Spring Reactor: adding delay but in an NON blocking way

关于如何以非阻塞方式在方法中添加延迟的小问题。 一种非常流行的模拟长进程的方法是使用Thread.sleep(); 但是,对于 Reactor 项目来说,这是一个阻塞操作。 众所周知,在反应式项目中,我们不应该阻塞。 我想试验和模拟长过程。 某种会花费大量时间的方法,但是以非阻塞方式,无需交换线程。 ...

微服务在springboot中如何使用jwt进行通信

[英]how microservice use jwt to communicate in springboot

我在 spring 引导中使用微服务,我想使用 jwt 和 oauth2 访问服务器。但我只是想知道除 api 网关之外的微服务如何获取 jwt(id 或名称)中的数据。这似乎很乏味在每个微服务中设置解码器。 我在想是否可以在 httprequest 解码和添加数据并将其路由到 apigateway ...

Flux last() 为空时的操作

[英]Flux last() operation when empty

当我需要获取通量的最后一个元素(最后一种方法)时,我正在尝试解决我的问题,但在某些情况下,这些通量可能为空并且出现跟随错误 这是我的链条 我也已经使用switchIfEmpty()但无法修复。 验证是否可以调用 last() 或跳过并返回空以终止链操作的正确实现是什么。 谢谢, ...

Spring Reactive - 方法的异常处理不允许异常不触发后 Spring 3.0.0 & Java 17 升级

[英]Spring Reactive - Exception Handling for Method Not Allowed Exception not triggering post Spring 3.0.0 & Java 17 upgrade

我们最近升级了在 Java 11 和 Spring 2.7.x 上运行的 Spring Reactive API。 Controller 层中的异常由 Global Exception Handler 处理,该异常处理程序还处理 Method Not Supported 异常。 升级后,当我们尝试 ...

使用模拟异常测试自定义谓词由于不正确的模拟而失败 class

[英]Testing custom predicate using mocked Exception failing due to incorrect Mock class

我在下面创建了一个自定义Predicate并想使用mockito对其进行测试。 我正在创建特定异常类的模拟,因为它们没有公共构造函数。 运行测试后断言失败,因为predicate返回false而不是true 。 在打印模拟异常的class时,它有WebClientResponseException ...

reactor kafka receive():通过 publishOn() 获得性能提升?

[英]reactor kafka receive(): Performace gain with publishOn()?

请关于反应堆卡夫卡消费者的小问题。 在网上找到的许多教程中,我们可以看到两种不同的响应式 kafka 消费者构造。 示例 1: 示例 2: 示例 1 和示例 2 之间的主要区别在于消息的实际处理/处理/执行逻辑要么直接在 map 方法(示例 1)上执行,要么在反应器调度程序(示例 2)上执行。 假 ...

如何在 Java 项目反应器中记录管道?

[英]how to log pipelines in Java project reactor?

我已经启动了一个使用 java 反应器和 spring webFLux 的新项目。 最近我不得不调试一个生产错误,这是一场噩梦,因为他们没有记录任何东西。 因此,通过阅读我发现了两种开始向管道添加日志的方法。 一种是使用 .log(),另一种是使用 onErrorResume、doOnSubscr ...


 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM