From 93660281d640b684c66fd95727dcf31840ed68d5 Mon Sep 17 00:00:00 2001 From: jeffgrunewald Date: Tue, 4 Jun 2019 14:35:39 -0400 Subject: [PATCH] Toggling auto creation of topics --- lib/divo_kafka.ex | 2 ++ mix.exs | 2 +- mix.lock | 6 +++--- test/divo_kafka_test.exs | 4 +++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/divo_kafka.ex b/lib/divo_kafka.ex index e4917a4..1b12e3b 100644 --- a/lib/divo_kafka.ex +++ b/lib/divo_kafka.ex @@ -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 @@ -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", diff --git a/mix.exs b/mix.exs index 28cace1..0bde226 100644 --- a/mix.exs +++ b/mix.exs @@ -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(), diff --git a/mix.lock b/mix.lock index 90a517a..ae80958 100644 --- a/mix.lock +++ b/mix.lock @@ -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"}, diff --git a/test/divo_kafka_test.exs b/test/divo_kafka_test.exs index 3deff2b..915a235 100644 --- a/test/divo_kafka_test.exs +++ b/test/divo_kafka_test.exs @@ -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", @@ -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", @@ -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