Skip to content

Missing observation for @JmsListener response messages #33221

@jghandour

Description

@jghandour

When using @JmsListener that is configured with an ObservationRegistry can see that the ObservationRegistry is used for the incoming message but not utilized for the outgoing response message. Specifically, the 'traceparent' header is not included in the response. This was using Spring JMS 6.1.10 via Spring Boot 3.3.1.

A simple workout in the meantime is to explicitly use a JmsTemplate configured with ObservationRegistry to send a response.

@Bean
DefaultJmsListenerContainerFactory jmsContainerFactory(ConnectionFactory connectionFactory, ObservationRegistry registry) {
DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
factory.setConnectionFactory(connectionFactory)
factory.setObservationRegistry(registry);
return factory;
}

@JmsListener("someQueue")
Message<String> handleMessage(Message message) { 
// Do stuff
return MessageBuilder.withPayload("test").build();
}

Metadata

Metadata

Assignees

Labels

in: messagingIssues in messaging modules (jms, messaging)theme: observabilityAn issue related to observability and tracingtype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions