Skip to content

Commit

Permalink
Merge pull request #8 from smartcitiesdata/toggle_auto_topics
Browse files Browse the repository at this point in the history
Toggling auto creation of topics
  • Loading branch information
jeffgrunewald authored Jun 4, 2019
2 parents a8f516a + 9366028 commit 896a887
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions lib/divo_kafka.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ defmodule DivoKafka do
def gen_stack(envars) do
topics = Keyword.get(envars, :create_topics, "clusterready:1:1")
host = Keyword.get(envars, :outside_host, "localhost")
auto_create_topics = Keyword.get(envars, :auto_topic, true)

check_topic =
topics
Expand All @@ -38,6 +39,7 @@ defmodule DivoKafka do
image: "wurstmeister/kafka:latest",
ports: ["9092:9092"],
environment: [
"KAFKA_AUTO_CREATE_TOPICS_ENABLE=#{auto_create_topics}",
"KAFKA_ADVERTISED_LISTENERS=INSIDE://:9094,OUTSIDE://#{host}:9092",
"KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT",
"KAFKA_LISTENERS=INSIDE://:9094,OUTSIDE://:9092",
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule DivoKafka.MixProject do
def project do
[
app: :divo_kafka,
version: "0.1.2",
version: "0.1.3",
elixir: "~> 1.8",
start_permanent: Mix.env() == :prod,
deps: deps(),
Expand Down
6 changes: 3 additions & 3 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
%{
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm"},
"credo": {:hex, :credo, "1.0.4", "d2214d4cc88c07f54004ffd5a2a27408208841be5eca9f5a72ce9e8e835f7ede", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm"},
"divo": {:hex, :divo, "1.1.4", "ead2cd0a060c5d6a670b1981837e59783a69b0aec01dea3d03dac981f1908d30", [:mix], [{:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:patiently, "~> 0.2", [hex: :patiently, repo: "hexpm", optional: false]}], "hexpm"},
"credo": {:hex, :credo, "1.0.5", "fdea745579f8845315fe6a3b43e2f9f8866839cfbc8562bb72778e9fdaa94214", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm"},
"divo": {:hex, :divo, "1.1.5", "99cd806438277e0e083df034cb53e3dcfcdb805fdac27a3f7783574c30031a7c", [:mix], [{:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:patiently, "~> 0.2", [hex: :patiently, repo: "hexpm", optional: false]}], "hexpm"},
"earmark": {:hex, :earmark, "1.3.2", "b840562ea3d67795ffbb5bd88940b1bed0ed9fa32834915125ea7d02e35888a5", [:mix], [], "hexpm"},
"ex_doc": {:hex, :ex_doc, "0.19.3", "3c7b0f02851f5fc13b040e8e925051452e41248f685e40250d7e40b07b9f8c10", [:mix], [{:earmark, "~> 1.2", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.10", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm"},
"ex_doc": {:hex, :ex_doc, "0.20.2", "1bd0dfb0304bade58beb77f20f21ee3558cc3c753743ae0ddbb0fd7ba2912331", [:mix], [{:earmark, "~> 1.3", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.10", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm"},
"jason": {:hex, :jason, "1.1.2", "b03dedea67a99223a2eaf9f1264ce37154564de899fd3d8b9a21b1a6fd64afe7", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm"},
"makeup": {:hex, :makeup, "0.8.0", "9cf32aea71c7fe0a4b2e9246c2c4978f9070257e5c9ce6d4a28ec450a839b55f", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm"},
"makeup_elixir": {:hex, :makeup_elixir, "0.13.0", "be7a477997dcac2e48a9d695ec730b2d22418292675c75aa2d34ba0909dcdeda", [:mix], [{:makeup, "~> 0.8", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm"},
Expand Down
4 changes: 3 additions & 1 deletion test/divo_kafka_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ defmodule DivoKafkaTest do
image: "wurstmeister/kafka:latest",
ports: ["9092:9092"],
environment: [
"KAFKA_AUTO_CREATE_TOPICS_ENABLE=true",
"KAFKA_ADVERTISED_LISTENERS=INSIDE://:9094,OUTSIDE://localhost:9092",
"KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT",
"KAFKA_LISTENERS=INSIDE://:9094,OUTSIDE://:9092",
Expand Down Expand Up @@ -52,6 +53,7 @@ defmodule DivoKafkaTest do
image: "wurstmeister/kafka:latest",
ports: ["9092:9092"],
environment: [
"KAFKA_AUTO_CREATE_TOPICS_ENABLE=true",
"KAFKA_ADVERTISED_LISTENERS=INSIDE://:9094,OUTSIDE://ci-host:9092",
"KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT",
"KAFKA_LISTENERS=INSIDE://:9094,OUTSIDE://:9092",
Expand All @@ -70,7 +72,7 @@ defmodule DivoKafkaTest do
}
|> Map.merge(@zookeeper)

actual = DivoKafka.gen_stack(outside_host: "ci-host", create_topics: "streaming-data:1:1")
actual = DivoKafka.gen_stack(auto_topic: true, outside_host: "ci-host", create_topics: "streaming-data:1:1")

assert actual == expected
end
Expand Down

0 comments on commit 896a887

Please sign in to comment.