|
22 | 22 | import java.util.concurrent.atomic.AtomicBoolean;
|
23 | 23 | import java.util.concurrent.atomic.AtomicInteger;
|
24 | 24 |
|
| 25 | +import io.micrometer.observation.ObservationRegistry; |
25 | 26 | import io.micrometer.observation.tck.TestObservationRegistry;
|
26 | 27 | import io.micrometer.observation.tck.TestObservationRegistryAssert;
|
27 | 28 | import jakarta.jms.JMSException;
|
|
56 | 57 | import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
|
57 | 58 | import org.springframework.integration.jms.ActiveMQMultiContextTests;
|
58 | 59 | import org.springframework.integration.jms.JmsDestinationPollingSource;
|
| 60 | +import org.springframework.integration.jms.JmsMessageDrivenEndpoint; |
59 | 61 | import org.springframework.integration.jms.SubscribableJmsChannel;
|
60 | 62 | import org.springframework.integration.scheduling.PollerMetadata;
|
61 | 63 | import org.springframework.integration.support.MessageBuilder;
|
@@ -129,6 +131,9 @@ public class JmsTests extends ActiveMQMultiContextTests {
|
129 | 131 | @Qualifier("jmsOutboundGateway.handler")
|
130 | 132 | private MessageHandler jmsOutboundGatewayHandler;
|
131 | 133 |
|
| 134 | + @Autowired |
| 135 | + JmsMessageDrivenEndpoint containerWithObservation; |
| 136 | + |
132 | 137 | @Autowired
|
133 | 138 | private AtomicBoolean jmsMessageDrivenChannelCalled;
|
134 | 139 |
|
@@ -192,6 +197,9 @@ public void testJmsOutboundInboundFlow() {
|
192 | 197 | .extracting(Message::getPayload)
|
193 | 198 | .isEqualTo("HELLO THROUGH THE JMS");
|
194 | 199 |
|
| 200 | + assertThat(TestUtils.getPropertyValue(this.containerWithObservation, "listenerContainer.observationRegistry")) |
| 201 | + .isSameAs(this.observationRegistry); |
| 202 | + |
195 | 203 | this.jmsOutboundInboundChannel.send(MessageBuilder.withPayload("hello THROUGH the JMS")
|
196 | 204 | .setHeader(SimpMessageHeaderAccessor.DESTINATION_HEADER, "jmsMessageDriven")
|
197 | 205 | .build());
|
@@ -406,13 +414,16 @@ public IntegrationFlow pubSubFlow(SubscribableJmsChannel jmsPublishSubscribeChan
|
406 | 414 | }
|
407 | 415 |
|
408 | 416 | @Bean
|
409 |
| - public IntegrationFlow jmsMessageDrivenFlow() { |
| 417 | + public IntegrationFlow jmsMessageDrivenFlow(ObservationRegistry observationRegistry) { |
410 | 418 | return IntegrationFlow
|
411 | 419 | .from(Jms.messageDrivenChannelAdapter(amqFactory,
|
412 | 420 | DefaultMessageListenerContainer.class)
|
413 | 421 | .outputChannel(jmsMessageDrivenInputChannel())
|
414 | 422 | .destination("jmsMessageDriven")
|
415 |
| - .configureListenerContainer(c -> c.clientId("foo"))) |
| 423 | + .configureListenerContainer(c -> c |
| 424 | + .clientId("foo") |
| 425 | + .observationRegistry(observationRegistry)) |
| 426 | + .id("containerWithObservation")) |
416 | 427 | .<String, String>transform(String::toLowerCase)
|
417 | 428 | .channel(jmsOutboundInboundReplyChannel())
|
418 | 429 | .get();
|
|
0 commit comments