https://github.com/marschall/jfr-jmstemplate
an implementation of Spring JmsTemplate that generates Flight Recorder events
https://github.com/marschall/jfr-jmstemplate
java-flight-recorder jms spring-jms
Last synced: 3 months ago
JSON representation
an implementation of Spring JmsTemplate that generates Flight Recorder events
- Host: GitHub
- URL: https://github.com/marschall/jfr-jmstemplate
- Owner: marschall
- Created: 2019-07-05T08:28:27.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2025-03-01T21:50:51.000Z (3 months ago)
- Last Synced: 2025-03-01T22:25:31.430Z (3 months ago)
- Topics: java-flight-recorder, jms, spring-jms
- Language: Java
- Size: 421 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
JFR JmsTemplate [](https://maven-badges.herokuapp.com/maven-central/com.github.marschall/jfr-jmstemplate) [](https://www.javadoc.io/doc/com.github.marschall/jfr-jmstemplate)
===============An implementation of Spring [JmsTemplate](https://docs.spring.io/spring/docs/current/spring-framework-reference/integration.html#jms-jmstemplate) that generates [Flight Recorder](https://openjdk.java.net/jeps/328) events.
Versions 2.x are for Jakarta EE 9+ / Spring 6, versions 1.x are for Jakarta EE 8 / Spring 5.
```xml
com.github.marschall
jfr-jmstemplate
2.0.0```

Compared to approaches based on `ConnectionFactory` an approach based on `JmsTemplate` has the advantage that it captures a complete queue interaction. A `JmsTemplate` based approach generates a single JFR event for an entire message queue interaction that involves several JMS method invocations.
Overhead
--------We try to keep overhead to a minimum and have no additional allocations besides the JFR events. Besides the overhead of the event the only additional overhead is
* a wrapper around `JmsTemplate`
* a few `instanceof` operations and casts
* a `finally` blockWe assume `jakarta.jms.Queue#getQueueName()` and `jakarta.jms.Topic#getTopicName()` are simple getters.
Usage
-----```java
@Configuration
public class JmsConfiguration {@Autowired
private ConnectionFactory connectionFactory;@Bean
public JmsOperations jmsOperations() {
return new JfrJmsOperations(new JmsTemplate(this.connectionFactory));
}}
```Limitations
-----------* We can not intercept `JmsTemplate#setDefaultDestination(Destination)` or `JmsTemplate#setDefaultDestinationName(String)` so for operations on the default destination we can not report the destination name.