llinder commented on a change in pull request #904: Messaging adapter
URL:
https://github.com/apache/incubator-zipkin-brave/pull/904#discussion_r285528723
##########
File path: instrumentation/jms/src/main/java/brave/jms/JmsAdapter.java
##########
@@ -0,0 +1,123 @@
+package brave.jms;
+
+import brave.messaging.ChannelAdapter;
+import brave.messaging.MessageConsumerAdapter;
+import brave.messaging.MessageProducerAdapter;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.Queue;
+import javax.jms.Topic;
+
+import static brave.jms.JmsTracing.JMS_QUEUE;
+import static brave.jms.JmsTracing.JMS_TOPIC;
+
+class JmsAdapter {
+
+ static class JmsMessageConsumerAdapter implements
MessageConsumerAdapter<Message> {
+
+ final JmsTracing jmsTracing;
+
+ JmsMessageConsumerAdapter(JmsTracing jmsTracing) {
+ this.jmsTracing = jmsTracing;
+ }
+
+ static JmsMessageConsumerAdapter create(JmsTracing jmsTracing) {
+ return new JmsMessageConsumerAdapter(jmsTracing);
+ }
+
+ @Override public String operation(Message message) {
+ return "receive";
+ }
+
+ @Override public String identifier(Message message) {
+ try {
+ return message.getJMSMessageID();
+ } catch (JMSException e) {
+ // don't crash on wonky exceptions!
+ }
+ return null;
+ }
+
+ @Override public void clearPropagation(Message message) {
Review comment:
My personal preference would be to return the `Message`. Reasoning is that
some libraries or coding choices may prefer immutable data structures where
copying and returning a new object is required.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]