File tree Expand file tree Collapse file tree
bottlecap/src/lifecycle/invocation/triggers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,9 +55,10 @@ fn bytes_from_header_value(val: &Value) -> Option<Vec<u8>> {
5555 }
5656}
5757
58- /// Extracts trace propagation headers from an MSK record's `headers` field into a carrier map.
59- /// The `headers` field is a JSON object with numeric string keys, one entry per Kafka header.
60- fn carrier_from_headers ( headers : & Value ) -> HashMap < String , String > {
58+ /// Decodes an MSK record's `headers` field into a `HashMap<String, String>` by converting
59+ /// each header's byte values to a UTF-8 string. The `headers` field may be either a JSON
60+ /// array or a JSON object with numeric string keys, one entry per Kafka header, ordered by index.
61+ fn headers_to_string_map ( headers : & Value ) -> HashMap < String , String > {
6162 let mut carrier = HashMap :: new ( ) ;
6263
6364 let entries: Vec < & Value > = match headers {
@@ -185,7 +186,7 @@ impl Trigger for MSKEvent {
185186 self . records
186187 . values ( )
187188 . find_map ( |arr| arr. first ( ) )
188- . map_or_else ( HashMap :: new, |record| carrier_from_headers ( & record. headers ) )
189+ . map_or_else ( HashMap :: new, |record| headers_to_string_map ( & record. headers ) )
189190 }
190191
191192 fn is_async ( & self ) -> bool {
You can’t perform that action at this time.
0 commit comments