Take out common code in a base class

This commit is contained in:
Vladan Popovic 2020-09-04 19:45:43 +02:00
parent 916fcf1bab
commit eaf0b51fe9
3 changed files with 31 additions and 18 deletions

View file

@ -3,22 +3,17 @@ Sample consumer.
"""
import asyncio
import json
import logging
from typing import Any, Dict
import aiokafka # type: ignore
import asyncpg # type: ignore
from chweb.base import Application
from chweb.models import Check
class Consumer:
def __init__(self, config: Dict[str, Any],
event_loop: asyncio.AbstractEventLoop,
queue: asyncio.Queue):
self.config = config
self.loop = event_loop
self.queue = queue
class Consumer(Application):
async def consume(self):
"""
Consumes messages from a Kafka topic.