{"id":22750401,"url":"https://github.com/ruby2elixir/db2kafka","last_synced_at":"2025-03-30T06:23:03.320Z","repository":{"id":136974735,"uuid":"76988518","full_name":"ruby2elixir/db2kafka","owner":"ruby2elixir","description":null,"archived":false,"fork":false,"pushed_at":"2016-12-20T19:10:08.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-05T08:28:56.553Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ruby2elixir.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-20T20:14:59.000Z","updated_at":"2020-09-23T18:27:05.000Z","dependencies_parsed_at":"2024-04-23T03:30:11.146Z","dependency_job_id":null,"html_url":"https://github.com/ruby2elixir/db2kafka","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby2elixir%2Fdb2kafka","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby2elixir%2Fdb2kafka/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby2elixir%2Fdb2kafka/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruby2elixir%2Fdb2kafka/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ruby2elixir","download_url":"https://codeload.github.com/ruby2elixir/db2kafka/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246283023,"owners_count":20752494,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-11T04:14:42.121Z","updated_at":"2025-03-30T06:23:03.312Z","avatar_url":"https://github.com/ruby2elixir.png","language":"Elixir","readme":"# Db2Kafka\n\n[![Build Status](https://travis-ci.org/PagerDuty/db2kafka.svg?branch=master)](https://travis-ci.org/PagerDuty/db2kafka)\n\nThis service takes records from a database's `outbound_kafka_queue` table and\nships them to Kafka. We developed it to solve an in-house problem: how do you\nmove data into Kafka while keeping our Rails app's transactional boundaries?\n\nWe are aware that this is a bit of a hack - using tables as queues always ends\nup in tears. However, it is a quick way to write data from Rails within the\nscope of a MySQL transaction, it is lighter weight and arguably more flexible\nthan a binlog-based solution, and it works for us.\n\nHopefully it works for you, too ;-)\n\nNote that documentation is mildly lacking at the moment, probably. We've been running\nthis thing for a while, so it's all logical and straightforward to us. Feel free to raise\nissues if there's something specific missing so we can hone our efforts.\n\n## Development\n\n### Setup\n\n#### Elixir\n\nShort version: `iex -S mix` to run the service in development; `mix test --only unit --no-start` to run unit tests\n\n#### MySQL\n\nSetup the various database environment variables as per config/ before proceeding. You need a table called `outbound_kafka_queue` in your database:\n\n```sql\nCREATE TABLE `outbound_kafka_queue` (\n  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n  `topic` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL,\n  `item_key` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL,\n  `item_body` varbinary(60000) DEFAULT NULL,\n  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n  PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;\n```\n\n#### Kafka\n\nInstall [Kafka](http://kafka.apache.org/) if you don't already have it running!\n\nSetup the various Kafka environment variables as per config/ before proceeding.\n\n### Running Tests\n\n#### Static Analysis\n\n        mix dialyzer\n\nResolve all the warnings before submitting a PR!\n\nTo speed up `dialyzer`, build a Persistent Lookup Table (PLT):\n\n        mix dialyzer.plt\n\n#### Unit Tests\n\n        mix test --only unit --no-start\n\n#### Integration Tests\n\n- Create MySQL database (see above for schema);\n\n- Create Kafka topic:\n\n        kafka-topics.sh --zookeeper 127.0.0.1:2181 --create --topic foo --partitions 1 --replication-factor 1\n\n\n- Run Integration Tests\n\n        mix test --only integration --no-start\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruby2elixir%2Fdb2kafka","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fruby2elixir%2Fdb2kafka","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruby2elixir%2Fdb2kafka/lists"}