GH-855 - Support to add headers in event externalization.
EventExternalizationConfiguration now exposes a ….headers(Class<T>, Function<T, Map<String, Object>) to allow to define a function that extracts headers from the event that are supposed to added to the message to be sent out. The Kafka and AMQP implementations have been augmented to consider those configurations. Furthermore, if the mapping step prior to the externalization creates a Spring Message<?>, we add routing information as fallback and send it out as is.
This commit is contained in:
@@ -28,6 +28,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.kafka.core.KafkaOperations;
|
||||
import org.springframework.messaging.Message;
|
||||
|
||||
/**
|
||||
* @author Oliver Drotbohm
|
||||
@@ -44,9 +45,9 @@ public class TestApplication {
|
||||
|
||||
var mock = mock(KafkaOperations.class);
|
||||
|
||||
when(mock.send(any(), any())).then(invocation -> {
|
||||
when(mock.send(any(Message.class))).then(invocation -> {
|
||||
|
||||
logger.info("Sending message {} to {}.", invocation.getArguments()[1], invocation.getArguments()[0]);
|
||||
logger.info("Sending message {}.", invocation.getArguments()[0]);
|
||||
|
||||
return null;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user