Comments (11)
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.
@sdball is this conflating Heroku concerns w/ env-var concerns?
from kaffe.
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.
I think I disagree, but can also see it's orthogonal to @sweco-semtne's questions so will take it offline 😄
from kaffe.
@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.
Thanks! It looks like it is exactly what I'm looking for.
from kaffe.
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.
Yeah, happy to @sdball. No problem 👍
from kaffe.
@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.
I believe this could be closed now, @sweco-semtne ?
Hopefully you got everything working 👍
from kaffe.
Looks like this issue has been resolved with #34. Closing due to inactivity.
from kaffe.
Related Issues (20)
- Defining multiple handlers HOT 1
- worker_per_topic_partition with multiple topics HOT 1
- Examples not compatible with Elixir 1.10 or 1.11 HOT 2
- extract_der is giving error with SSL HOT 2
- Undefined function exponential_backoff HOT 10
- Offset doesn't get updated between runs and runs crash with OOM errors HOT 4
- async ack - lots of duplicate messages until I restart the application HOT 2
- Kaffe.Producer.produce_sync raises on timeout
- How to set kafka headers when publishing message HOT 1
- Invalid call to raise/reraise on brod/kpro error
- Add support for SCRAM mechanism in SASL authentication. HOT 1
- Module to help write ExUnit tests
- It's impossible to create 2 separate consumers for different topics
- Running mix with kaffe deps fails to download pc package from hex
- Wrong place for configuration
- Config dump on error leaks credentials HOT 1
- Endpoints configuration is weird for using ENV vars
- Missing documentation HOT 8
- Connecting to a TLS-based Kafka instance under AWS MSK? HOT 18
- Receives notification when rebalance in progress/assignments revoked HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kaffe.