Skip to content

Instantly share code, notes, and snippets.

View stefanopassador's full-sized avatar

Stefano Passador stefanopassador

  • London, UK
View GitHub Profile
@stefanopassador
stefanopassador / docker-compose.yml
Created March 29, 2023 14:36
docker-compose for PubSub2MongoDB tutorial
version: "3.8"
services:
streaming-publisher:
build: ./streaming-publisher/
batch-subscriber:
build: ./batch-subscriber/
depends_on:
- mongodb
mongodb:
image: arm64v8/mongo:4.0
@stefanopassador
stefanopassador / batch-subscriber_Dockerfile
Created March 29, 2023 14:32
Batch subscriber Dockerfile
FROM python:latest
WORKDIR /code
ADD batch-subscription-service-account.json batch-subscription-service-account.json
ADD requirements.txt requirements.txt
RUN pip install -r requirements.txt
COPY app.py app.py
CMD ["python", "-u", "app.py"]
@stefanopassador
stefanopassador / batch-subscriber-complete_app.py
Created March 29, 2023 14:30
Batch subscriber python code
import os
import time
import random
import json
from google.cloud import pubsub_v1
from pymongo import MongoClient
## GCP config
PROJECT_ID = 'streaming-ingestion-XXXXXX'
TOPIC_ID = 'sample-topic'
@stefanopassador
stefanopassador / batch-subscriber_app.py
Last active March 29, 2023 14:31
Code for Batch Subscriber
import os
import time
import random
import json
from google.cloud import pubsub_v1
## GCP config
PROJECT_ID = 'streaming-ingestion-XXXXXX'
TOPIC_ID = 'sample-topic'
SUBSCRIPTION_ID = 'sample-topic-sub'
@stefanopassador
stefanopassador / streaming-publisher_Dockerfile
Created March 29, 2023 14:21
Streaming Publisher Dockerfile
FROM python:latest
WORKDIR /code
ADD streaming-publisher-service-account.json streaming-publisher-service-account.json
ADD requirements.txt requirements.txt
RUN pip install -r requirements.txt
COPY app.py app.py
CMD ["python", "-u", "app.py"]