TraceId missing when logging #SqsListener - spring-boot

In my spring boot project, TraceId missing only inside #SqsListener annotated method.
I have used spring-cloud-starter-sleuth for logging and logback configuration.

Which sleuth version are you using? They removed SQS support since 3.0 release. https://github.com/spring-cloud/spring-cloud-sleuth/issues/1876.
This repo can be helpful in implementing putting traces into SQS messages but getting them from the message and injecting into MDC you need to implement on your own.

Related

error handling spring boot kafka library feature

I want to include a feature in my spring boot Kafka library which enables the user to just call a listener which includes a retry logic for the messages which are getting failed.Help me with that.

What is the equivalent object of Exchange (Camel) in Spring Boot?

I am trying to migrate an application built with Camel in Spring Boot, but i'm not using the Exchange object of Camel, so i have to use some other object to do the work of Exchange. Can anybody give me an idea about that?
SpringBoot is not an integration framework like Camel. Spring Integration is the counterpart of Camel in the Spring ecosystem. Although SpringBoot and the Spring framework works very well with Camel too.
However, the Camel Exchange is a Camel concept. I think there is nothing similar in Spring Integration.
The Camel Exchange is like an internal, enriched message. A wrapper around an in- and out-message (out is deprecated since Camel 3) and it holds additional state information such as Exchange properties (non-routable headers), Exceptions etc.
As far as I know, in Spring integration there is just the message. No wrapper around it.

How do implementations like Spring Cloud Sleuth are made?

By adding Spring Cloud Sleuth as a dependency in my Spring Boot project the logging mask, like magic, changes.
The change that happens is the inclusion of the traceId, spanId and applicationName in the informations that are logged when I do log.info(...) and other logging commands.
How do Spring Cloud Sleuth does that? Is that a appender implementation? Do a programatically change happens in the log mask to be able to print it when Spring Boot auto-configuration is started?

Baggage Propagation in Jms using Spring Cloud Sleuth

I'm trying to use the baggage propagation offered by Spring Cloud Sleuth. In the calls that use the Feign client I don't have any kind of problem, I can propagate custom fields, while while using JmsTemplate of Spring JMS I can't propagate the same fields.
My application is a Spring Boot application, version 2.1.5, with Spring Cloud version Greenwich.SR1.
In order to put the custom fields, I use
ExtraFieldPropagation.set("communicationId", "123456");
while, inside my application.properties, I put
spring.sleuth.baggage-keys= communicationId
I expect that the same functionality present for the Feign client, is also present for the producer JMS. Where am I wrong?

Logging Spring Integration exceptions using Spring Boot

We have experienced some exceptions ( mainly Channel without consumer ) in our Spring Integration pipeline. But those exceptions are lost and we dont see them unless we run the app and look at the console.
Is there any way to log those exceptions to a file ?
Boot uses logback by default. Add a suitably configured logback.xml to the class path.

Resources