I have two similiar projects. One with spring boot 2.7 and sleuth, another with spring boot 3.1.3 and micrometer. Codebase is almost the same, this is just a POC showing that micrometer still doesn't add traceid to jms messages using JmsTemplate
and @JmsListener
.
Working minimal examples are located here: https://github.com/mbadziong/micrometer-broken-tracing
Sender and Receiver classes:
@Component
public class Receiver {
private static Logger logger = LoggerFactory.getLogger(Receiver.class);
@JmsListener(destination = "test-queue")
// @Observed
public void receive(String s) {
logger.info("received message: {}", s);
}
}
@RestController
public class Sender {
private static Logger logger = LoggerFactory.getLogger(Sender.class);
@Autowired
JmsTemplate jmsTemplate;
@GetMapping
@ResponseStatus(HttpStatus.ACCEPTED)
public void send() {
logger.info("sending message...");
jmsTemplate.convertAndSend("test-queue", "hello");
}
}
In version with sleuth, receiver logs to the console with traceId and spanId. In version with micrometer trace is missing.
Do I miss some additional configuration to make it work?