Closed vearutop closed 1 year ago
Language | Files | Lines | Code | Comments | Blanks | Complexity | Bytes |
---|---|---|---|---|---|---|---|
Go | 29 (+1) | 2930 (+103) | 2148 (+65) | 280 (+15) | 502 (+23) | 392 (+13) | 76.4K (+2.7K) |
Go (test) | 7 (+1) | 1499 (+165) | 1204 (+127) | 46 (+5) | 249 (+33) | 84 (+3) | 42.3K (+4.1K) |
Markdown | 1 | 645 (+39) | 477 (+28) | 0 | 168 (+11) | 0 | 24.2K (+1.5K) |
# github.com/adjust/rmq/v5 ## compatible changes (*TestBatchConsumer).Consumed: added (*TestBatchConsumer).Last: added (*TestConsumer).Deliveries: added (*TestConsumer).Last: added ExtractHeaderAndPayload: added PayloadBytesWithHeader: added PayloadWithHeader: added WithHeader: added # summary Inferred base version: v5.0.2 Suggested version: v5.1.0
total: (statements) 71.6% changed lines: (statements) 94.3%
The approach and the implementation seem very good. 👍
@wellle I've added notes on compatibility to README, please check if they are clear enough (if you have better wording, please share).
Redis protocol does not define a specific way to pass additional data like header. However, there is often need to pass them (for example for traces propagation).
This implementation injects optional header values marked with a signature into payload body during publishing. When message is consumed, if signature is present, header and original payload are extracted from augmented payload.
Header is defined as
http.Header
for better interoperability with existing libraries, for example withpropagation.HeaderCarrier
.This change is intended to be backwards compatible.
Header parsing is only done if payload starts with
"\xFF\x00\xBE\xBEJ"
, such signature is added along with header values explicitly by caller during publishing (usingPayloadWithHeader
helper).