Take out common code in a base class
This commit is contained in:
parent
916fcf1bab
commit
eaf0b51fe9
3 changed files with 31 additions and 18 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue