Hi,
I've played with the APM for a while and I've got a bit further, however, the state is still not ideal.
This seems to work only partially. Or, to be precise, the transaction is indeed created when receiving a JMS message (even using Spring Integration), however, the transaction naming seems to rely on JMS headers of the message object itself (as opposed to the actual JMS consumer).
The practical effect is that e.g. when reading messages from MQ where the publisher does not necessarily populate JMS headers (and does not send messages in MQHRF2 format) the all transactions are called just "JMS RECEIVE" and it's impossible to see from which queue the message has been received. That is problematic in a situation where a service reads from multiple queues and we'd like to separate the transactions by queue/type.
Similarly e.g. with Solace, imagine the following scenario. Publishers publish messages to topics. Solace contains (persistent) queues subscribed to particular topics (potentially multiple). Receiver reads messages from queues. In this case, the captured transactions say "JMS RECEIVE from topic A/B/C" even though the receiver actually received a message from a queue (with a particular name), not a topic directly.
I'm using Spring Ingration Java DSL so the receiving/processing code looks something like this
@Bean
public IntegrationFlow myFlow() {
return IntegrationFlows
.from(Jms.messageDrivenChannelAdapter(jmsConnectionFactory)
.destination(queueName))
.transform(someTransformer)
.transform(anotherTransformer)
.handle(someHandler)
.get()
}
However, the flow in general does not need to include messaging at all, so according to https://docs.spring.io/spring-integration/reference/html/dsl.html you can create a flow (that keeps printing Hello ...) like this
@Configuration
@EnableIntegration
public class MyConfiguration {
@Bean
public AtomicInteger integerSource() {
return new AtomicInteger();
}
@Bean
public IntegrationFlow myFlow() {
return IntegrationFlow.fromSupplier(integerSource()::getAndIncrement,
c -> c.poller(Pollers.fixedRate(100)))
.filter((Integer p) -> p > 0)
.transform(Object::toString)
.transform("Hello "::concat)
.handle(System.out::println)
.get();
}
}
Ideally I'd like to be able to capture myFlow as a transaction in APM so that I can see how many times a particular flow has executed and how long it took.