This commit is contained in:
Marcin Grzejszczak
2020-12-18 16:09:29 +01:00
parent ed2e9e6633
commit 27ebc96baa
21 changed files with 31 additions and 28 deletions

View File

@@ -11,7 +11,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<version>2.4.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

View File

@@ -11,7 +11,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<version>2.4.1</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>

View File

@@ -11,7 +11,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<version>2.4.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

View File

@@ -11,7 +11,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<version>2.4.1</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>

View File

@@ -14,7 +14,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<version>2.4.1</version>
<relativePath/>
</parent>

View File

@@ -14,7 +14,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<version>2.4.1</version>
<relativePath/>
</parent>

View File

@@ -14,7 +14,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<version>2.4.1</version>
<relativePath/>
</parent>

View File

@@ -31,7 +31,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<version>2.4.1</version>
<relativePath/>
</parent>

View File

@@ -14,7 +14,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<version>2.4.1</version>
<relativePath/>
</parent>

View File

@@ -14,7 +14,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<version>2.4.1</version>
<relativePath/>
</parent>

View File

@@ -14,7 +14,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<version>2.4.1</version>
<relativePath/>
</parent>

View File

@@ -14,7 +14,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<version>2.4.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

View File

@@ -14,7 +14,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<version>2.4.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

View File

@@ -14,7 +14,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<version>2.4.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

View File

@@ -14,7 +14,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<version>2.4.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

View File

@@ -14,7 +14,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<version>2.4.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

View File

@@ -14,7 +14,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<version>2.4.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

View File

@@ -70,7 +70,7 @@
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>2.4.0</version>
<version>2.4.1</version>
<scope>test</scope>
</dependency>
<!-- end::dependencies[] -->

View File

@@ -69,7 +69,7 @@
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>2.4.0</version>
<version>2.4.1</version>
<scope>test</scope>
</dependency>
</dependencies>

View File

@@ -35,7 +35,7 @@ import org.springframework.context.annotation.Configuration;
/**
* @author Marcin Grzejszczak
*/
@Configuration(proxyBeanMethods = false)
@Configuration
class Issue178ListenerConfiguration {
@Bean

View File

@@ -18,7 +18,6 @@ package com.example;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -29,7 +28,7 @@ import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.Headers;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.stereotype.Component;
interface BookService {
@@ -64,19 +63,23 @@ public class RabbitManager {
@RabbitListener(bindings = @QueueBinding(value = @Queue,
exchange = @Exchange(value = "input", durable = "true", autoDelete = "false", type = "topic"),
key = "event"))
public void newBook(Book book, @Headers Map<String, String> headers) {
// Workaround for https://github.com/spring-projects/spring-amqp/issues/1285
// public void newBook(Book book, @Headers Map<String, String> headers) {
public void newBook(Book book, @Header("amqp_replyTo") String replyTo) {
LOG.info("Received new book with bookname = " + book.getName());
LOG.info("Headers = " + headers);
this.service.sendBook(book, headers.get("amqp_replyTo"));
// LOG.info("Headers = " + headers);
this.service.sendBook(book, replyTo);
}
@RabbitListener(bindings = @QueueBinding(value = @Queue,
exchange = @Exchange(value = "input", durable = "true", autoDelete = "false", type = "topic"),
key = "event2"))
public void newBook2(Book book, @Headers Map<String, String> headers) {
// Workaround for https://github.com/spring-projects/spring-amqp/issues/1285
// public void newBook2(Book book, @Headers Map<String, String> headers) {
public void newBook2(Book book, @Header("amqp_replyTo") String replyTo) {
LOG.info("newBook2 Received new book with bookname = " + book.getName());
LOG.info("newBook2 Headers = " + headers);
this.service.sendBook(book, headers.get("amqp_replyTo"));
// LOG.info("newBook2 Headers = " + headers);
this.service.sendBook(book, replyTo);
}
}