-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include metadata in the message-payload (#234)
* include the metadata in the message-payload * Added metadata as a separate key in message payload and remove kafka headers from rabbitmq message headers * Restoring headers specific changes in rabbitmq producer and mapper * Fixing tests in default_test and consumer_test * Added tests to verify that metadata is provided in the message payload * Modifying tests to take care of the new structure of the message payload * adds an assertion for retry-count * fixes linting * updates CHANGELOG and ziggurat version to 4.0.0 * Increase sleep before closing stream as well as the join window ms Co-authored-by: Michael Angelo Calimlim <macalimlim@gmail.com> Co-authored-by: prateek.khatri <prateek.khatri@gojek.com> Co-authored-by: shubhang.balkundi <2932-shubhang.balkundi@users.noreply.source.golabs.io> Co-authored-by: Anmol Vijaywargiya <anmol.vijaywargiya@go-jek.com>
- Loading branch information
1 parent
c4c6d81
commit 9fc470d
Showing
18 changed files
with
273 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,35 @@ | ||
(ns ziggurat.header-transformer-test | ||
(:require [clojure.test :refer :all] | ||
[ziggurat.header-transformer :refer :all]) | ||
(:import [org.apache.kafka.streams.processor ProcessorContext] | ||
[org.apache.kafka.common.header.internals RecordHeaders RecordHeader])) | ||
(:require [clojure.test :refer [deftest is testing]] | ||
[ziggurat.header-transformer :refer [create]]) | ||
(:import [org.apache.kafka.common.header.internals RecordHeaders RecordHeader] | ||
[org.apache.kafka.streams.processor ProcessorContext])) | ||
|
||
(deftest header-transformer-test | ||
(testing "transforms value with passed headers" | ||
(let [headers (RecordHeaders. (list (RecordHeader. "key" (byte-array (map byte "value"))))) | ||
context (reify ProcessorContext | ||
(headers [_] headers)) | ||
transformer (create) | ||
_ (.init transformer context) | ||
(let [headers (RecordHeaders. (list (RecordHeader. "key" (byte-array (map byte "value"))))) | ||
topic "topic" | ||
timestamp 1234567890 | ||
partition 1 | ||
context (reify ProcessorContext | ||
(headers [_] headers) | ||
(topic [_] topic) | ||
(timestamp [_] timestamp) | ||
(partition [_] partition)) | ||
transformer (create) | ||
_ (.init transformer context) | ||
transformed-val (.transform transformer "val")] | ||
(is (= {:value "val" :headers headers} transformed-val)))) | ||
(is (= {:value "val" :headers headers :metadata {:topic topic :timestamp timestamp :partition partition}} transformed-val)))) | ||
|
||
(testing "transforms value with nil headers when not passed" | ||
(let [context (reify ProcessorContext | ||
(headers [_] nil)) | ||
transformer (create) | ||
_ (.init transformer context) | ||
(let [topic "topic" | ||
timestamp 1234567890 | ||
partition 1 | ||
context (reify ProcessorContext | ||
(headers [_] nil) | ||
(topic [_] topic) | ||
(timestamp [_] timestamp) | ||
(partition [_] partition)) | ||
transformer (create) | ||
_ (.init transformer context) | ||
transformed-val (.transform transformer "val")] | ||
(is (= {:value "val" :headers nil} transformed-val))))) | ||
(is (= {:value "val" :headers nil :metadata {:topic topic :timestamp timestamp :partition partition}} transformed-val))))) |
Oops, something went wrong.