I've been trying to create a simple example of Spring Integration TCP whose uses a custom UUID header in the Message and send this message thought the TCP channel. After that I recover the same message in other service, but the header isn't going to the server.
This is how I created the message:
Message<byte[]> message1 = MessageBuilder
.withPayload(payload)
.setHeader("traceId", traceId)
.build();
This is my gateway class:
@MessagingGateway
public interface IntegrationGateway {
@Gateway(requestChannel = "toTcp")
String toOut(Message<byte[]> message);
}
This is my "listener" in the other service:
@ServiceActivator(inputChannel = "fromTcp")
public void convert(Message<byte[]> message) {
byte[] payload = message.getPayload();
UUID traceId = message.getHeaders().get("traceId", UUID.class);
}
But when I recover the message in the another service, this header is null.
Is it possible recover my custom header anyhow in the server?
question from:
https://stackoverflow.com/questions/65830009/is-it-possible-use-custom-header-in-spring-integration-tcp 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…