JAVA-29012 :- Update Spring WebFlux AMQP to Spring Boot 3. (#16076)
This commit is contained in:
parent
89cb132fe1
commit
693d3728a7
|
@ -11,24 +11,12 @@
|
|||
<description>Spring WebFlux AMQP Sample</description>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung.spring.reactive</groupId>
|
||||
<artifactId>spring-reactive-modules</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-boot-3</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../../parent-boot-3</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<!-- Import dependency management from Spring Boot -->
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<!-- <version>2.0.4.RELEASE</version> --><!-- works -->
|
||||
<version>2.1.3.RELEASE</version> <!-- Works with workaround applied -->
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.baeldung.spring.amqp;
|
|||
|
||||
import java.time.Duration;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -31,7 +31,7 @@ import reactor.core.publisher.Mono;
|
|||
@RestController
|
||||
public class AmqpReactiveController {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(AmqpReactiveController.class);
|
||||
private static final Logger log = LoggerFactory.getLogger(AmqpReactiveController.class);
|
||||
|
||||
@Autowired
|
||||
private AmqpTemplate amqpTemplate;
|
||||
|
@ -142,10 +142,10 @@ public class AmqpReactiveController {
|
|||
|
||||
MessageListenerContainer mlc = messageListenerContainerFactory.createMessageListenerContainer(d.getRoutingKey());
|
||||
|
||||
Flux<String> f = Flux.<String> create(emitter -> {
|
||||
Flux<String> f = Flux.create(emitter -> {
|
||||
|
||||
log.info("[I168] Adding listener, queue={}", d.getRoutingKey());
|
||||
mlc.setupMessageListener((MessageListener) m -> {
|
||||
mlc.setupMessageListener(m -> {
|
||||
|
||||
String qname = m.getMessageProperties()
|
||||
.getConsumerQueue();
|
||||
|
@ -233,11 +233,11 @@ public class AmqpReactiveController {
|
|||
|
||||
MessageListenerContainer mlc = messageListenerContainerFactory.createMessageListenerContainer(qname);
|
||||
|
||||
Flux<String> f = Flux.<String> create(emitter -> {
|
||||
Flux<String> f = Flux.create(emitter -> {
|
||||
|
||||
log.info("[I168] Adding listener, queue={}", qname);
|
||||
|
||||
mlc.setupMessageListener((MessageListener) m -> {
|
||||
mlc.setupMessageListener(m -> {
|
||||
|
||||
log.info("[I137] Message received, queue={}", qname);
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ public class SpringWebfluxAmqpLiveTest {
|
|||
|
||||
client.post()
|
||||
.uri("/queue/NYSE")
|
||||
.syncBody("Test Message")
|
||||
.bodyValue("Test Message")
|
||||
.exchange()
|
||||
.expectStatus().isAccepted();
|
||||
|
||||
|
|
Loading…
Reference in New Issue