项目作者: dashbitco

项目描述 :
A Broadway connector for Kafka
高级语言: Elixir
项目地址: git://github.com/dashbitco/broadway_kafka.git
创建时间: 2019-07-05T14:11:41Z
项目社区:https://github.com/dashbitco/broadway_kafka

开源协议:

下载


BroadwayKafka

Build Status

A Kafka connector for Broadway.

Documentation can be found at https://hexdocs.pm/broadway_kafka.

Installation

Add :broadway_kafka to the list of dependencies in mix.exs:

  1. def deps do
  2. [
  3. {:broadway_kafka, "~> 0.4.1"}
  4. ]
  5. end

Usage

Configure Broadway’s producer using BroadwayKafka.Producer:

  1. defmodule MyBroadway do
  2. use Broadway
  3. def start_link(_opts) do
  4. Broadway.start_link(__MODULE__,
  5. name: __MODULE__,
  6. producer: [
  7. module: {BroadwayKafka.Producer, [
  8. hosts: [localhost: 9092],
  9. group_id: "group_1",
  10. topics: ["test"],
  11. ]},
  12. concurrency: 1
  13. ],
  14. processors: [
  15. default: [
  16. concurrency: 10
  17. ]
  18. ]
  19. )
  20. end
  21. def handle_message(_, message, _) do
  22. IO.inspect(message.data, label: "Got message")
  23. message
  24. end
  25. end

License

Copyright 2019 Plataformatec\
Copyright 2020 Dashbit

Licensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  1. http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.