Skip to content

Commit

Permalink
[FundingCircle#262] Fix inability to materialize without supplying a …
Browse files Browse the repository at this point in the history
…topic name
  • Loading branch information
darin-reify committed Aug 23, 2022
1 parent 21226cb commit 61a7566
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### Unreleased

- Add `divert` stream operation
- Fix inability to materialize without supplying a topic name

### [0.9.6] - [2022-08-01]

Expand Down
8 changes: 5 additions & 3 deletions src/jackdaw/streams/interop.clj
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@
(Grouped/with key-serde value-serde))

(defn topic->materialized [{:keys [topic-name key-serde value-serde]}]
(cond-> (Materialized/as ^String topic-name)
key-serde (.withKeySerde key-serde)
value-serde (.withValueSerde value-serde)))
(if topic-name
(cond-> (Materialized/as ^String topic-name)
key-serde (.withKeySerde key-serde)
value-serde (.withValueSerde value-serde))
(Materialized/with key-serde value-serde)))

(defn suppress-config->suppressed
[{:keys [max-records max-bytes until-time-limit-ms]}]
Expand Down
15 changes: 15 additions & 0 deletions test/jackdaw/streams/interop_test.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(ns jackdaw.streams.interop-test
(:require
[clojure.test :refer :all]
[jackdaw.streams.interop :as interop])
(:import
(org.apache.kafka.common.serialization
Serdes)))

(deftest topic->materialized-test
(testing "materialized with serde only doesn't smoke"
(is (interop/topic->materialized {:key-serde (Serdes/String)
:value-serde (Serdes/String)})))
(testing "materialized with topic name and serde doesn't smoke"
(is (interop/topic->materialized {:key-serde (Serdes/String)
:value-serde (Serdes/String)}))))

0 comments on commit 61a7566

Please sign in to comment.