Giter VIP home page Giter VIP logo

Comments (11)

sdball avatar sdball commented on July 2, 2024

Hello! Yes that's entirely possible. The easiest approach would be to set heroku_kafka_env: true in the configuration and then ensure that KAFKA_URL is set as an ENV variable at runtime. The other Heroku compatible Kafka ENV variables for SSL are optional.

from kaffe.

rwdaigle avatar rwdaigle commented on July 2, 2024

@sdball is this conflating Heroku concerns w/ env-var concerns?

from kaffe.

sdball avatar sdball commented on July 2, 2024

I don't think so. The flag is for declaring the app is behaving in a Heroku-compatible manner. Kaffe's entire existence is designed around making talking to Heroku Kafka easy.

from kaffe.

rwdaigle avatar rwdaigle commented on July 2, 2024

I think I disagree, but can also see it's orthogonal to @sweco-semtne's questions so will take it offline 😄

from kaffe.

rawkode avatar rawkode commented on July 2, 2024

@sweco-semtne I wrote a library for run-time configuration for Kubernetes and Swarm (though environment vars are supported too)

https://github.com/GT8Online/weave

This is my handler for such a use-case:

  def handle_configuration("kafka_hosts", host_string) do
    brokers = host_string
    |> String.split(",")
    |> Enum.map(fn(uri) ->
      [host, port] = String.split(uri, ":")

      Keyword.put([], String.to_atom(host), String.to_integer(port))
    end)
    |> List.flatten()

    {:kaffe, :consumer, [endpoints: brokers]}
  end

  def handle_configuration("kafka_topic", topic) do
    {:kaffe, :consumer, [topics: [topic]]}
  end

from kaffe.

sweco-semtne avatar sweco-semtne commented on July 2, 2024

Thanks! It looks like it is exactly what I'm looking for.

from kaffe.

sdball avatar sdball commented on July 2, 2024

Wow, that looks fantastic @rawkode! Would you mind writing up that runtime configuration approach as a PR for the readme? Perhaps another section Runtime Configuration?

from kaffe.

rawkode avatar rawkode commented on July 2, 2024

Yeah, happy to @sdball. No problem 👍

from kaffe.

rawkode avatar rawkode commented on July 2, 2024

@sweco-semtne I've made it easier to configure a consumer and producer with a single handle_configuration/1:

https://github.com/GT8Online/weave/pull/27/files

from kaffe.

rawkode avatar rawkode commented on July 2, 2024

I believe this could be closed now, @sweco-semtne ?

Hopefully you got everything working 👍

from kaffe.

davidsantoso avatar davidsantoso commented on July 2, 2024

Looks like this issue has been resolved with #34. Closing due to inactivity.

from kaffe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.