15
15
import java .time .Clock ;
16
16
import java .time .Instant ;
17
17
import java .time .format .DateTimeFormatter ;
18
+ import java .util .Collections ;
18
19
import java .util .Locale ;
19
20
import java .util .Map ;
20
21
import java .util .Objects ;
@@ -49,6 +50,7 @@ public class TracingMessageConsumer implements MessageConsumer {
49
50
* @param sentRequests A map that keeps track of pending sent request data.
50
51
* @param receivedRequests A map that keeps track of pending received request data.
51
52
* @param printWriter Where to write the log to.
53
+ * @param jsonHandler The handler to be used to serialize messages.
52
54
* @param clock The clock that is used to calculate timestamps and durations.
53
55
*/
54
56
public TracingMessageConsumer (
@@ -67,6 +69,54 @@ public TracingMessageConsumer(
67
69
* @param receivedRequests A map that keeps track of pending received request data.
68
70
* @param printWriter Where to write the log to.
69
71
* @param clock The clock that is used to calculate timestamps and durations.
72
+ * @deprecated use {@link TracingMessageConsumer#TracingMessageConsumer(MessageConsumer, Map, Map, PrintWriter, MessageJsonHandler, Clock)}
73
+ */
74
+ @ Deprecated
75
+ public TracingMessageConsumer (
76
+ MessageConsumer messageConsumer ,
77
+ Map <String , RequestMetadata > sentRequests ,
78
+ Map <String , RequestMetadata > receivedRequests ,
79
+ PrintWriter printWriter ,
80
+ Clock clock ) {
81
+ this (messageConsumer , sentRequests , receivedRequests , printWriter , defaultHandlerWithoutUserAdapters (), clock , null );
82
+ }
83
+
84
+ /**
85
+ * For backward compatibility, we are using a default handler that does not contain any user adapters.
86
+ */
87
+ private static MessageJsonHandler defaultHandlerWithoutUserAdapters () {
88
+ return new MessageJsonHandler (Collections .emptyMap (), gsonBuilder -> {
89
+ gsonBuilder .setPrettyPrinting ();
90
+ });
91
+ }
92
+
93
+ /**
94
+ * @param messageConsumer The {@link MessageConsumer} to wrap.
95
+ * @param sentRequests A map that keeps track of pending sent request data.
96
+ * @param receivedRequests A map that keeps track of pending received request data.
97
+ * @param printWriter Where to write the log to.
98
+ * @param clock The clock that is used to calculate timestamps and durations.
99
+ * @param locale THe Locale to format the timestamps and durations, or <code>null</code> to use default locale.
100
+ * @deprecated use {@link TracingMessageConsumer#TracingMessageConsumer(MessageConsumer, Map, Map, PrintWriter, MessageJsonHandler, Clock, Locale)}
101
+ */
102
+ @ Deprecated
103
+ public TracingMessageConsumer (
104
+ MessageConsumer messageConsumer ,
105
+ Map <String , RequestMetadata > sentRequests ,
106
+ Map <String , RequestMetadata > receivedRequests ,
107
+ PrintWriter printWriter ,
108
+ Clock clock ,
109
+ Locale locale ) {
110
+ this (messageConsumer , sentRequests , receivedRequests , printWriter , defaultHandlerWithoutUserAdapters (), clock , locale );
111
+ }
112
+
113
+ /**
114
+ * @param messageConsumer The {@link MessageConsumer} to wrap.
115
+ * @param sentRequests A map that keeps track of pending sent request data.
116
+ * @param receivedRequests A map that keeps track of pending received request data.
117
+ * @param printWriter Where to write the log to.
118
+ * @param jsonHandler The handler to be used to serialize messages.
119
+ * @param clock The clock that is used to calculate timestamps and durations.
70
120
* @param locale THe Locale to format the timestamps and durations, or <code>null</code> to use default locale.
71
121
*/
72
122
public TracingMessageConsumer (
0 commit comments