Skip to content

Instantly share code, notes, and snippets.

View antunesleo's full-sized avatar

Leonardo Antunes antunesleo

View GitHub Profile
import json
import sys
from kafka import KafkaProducer
from outboxexample import settings
import signal
producer = KafkaProducer(bootstrap_servers=[settings.KAFKA_HOST])
import json
from kafka import KafkaConsumer
from outboxexample import settings
print("starting consumer", settings.KAFKA_HOST)
NOTES_TOPIC = "notes"
version: '3.7'
networks:
my_network:
services:
zookeeper:
image: confluentinc/cp-zookeeper:latest
hostname: zookeeper
environment:
@antunesleo
antunesleo / jaiminho-tutorial-start-project.sh
Last active May 12, 2023 16:45
jaiminho-tutorial-start-project.sh
mkdir django-jaiminho-outbox-example
cd django-jaiminho-outbox-example
pip install django==4.2
django-admin startproject outboxexample .
python manage.py startapp notes
├── notes
│ ├── admin.py
│ ├── apps.py
│ ├── __init__.py
│ ├── kafka_producer.py
│ ├── migrations
│ │ ├── 0001_initial.py
│ │ ├── __init__.py
│ ├── models.py
│ ├── tests.py
relayer:
build: .
command: python manage.py events_relay --run-in-loop
volumes:
- .:/app
env_file:
- .env
depends_on:
kafka:
condition: service_healthy
python manage.py migrate
from jaiminho.constants import PublishStrategyType
JAIMINHO_CONFIG = {
"PUBLISH_STRATEGY": PublishStrategyType.KEEP_ORDER,
}