我正在运行本地的kafka生产者以产生消息,并为其创建了主题“ test_topic”。 在这里,我在Django项目的settings.py中包含了logpipe设置。我还提到了引导服务器作为我的本地主机
#LOGPIPE SETTINGS in settings.py:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'logpipe',
]
LOGPIPE = {
# Required Settings
'OFFSET_BACKEND': 'logpipe.backend.kafka.ModelOffsetStore',
'CONSUMER_BACKEND': 'logpipe.backend.kafka.Consumer',
'PRODUCER_BACKEND': 'logpipe.backend.kafka.Producer',
'KAFKA_BOOTSTRAP_SERVERS': [
'localhost:9092'
],
'KAFKA_CONSUMER_KWARGS': {
'group_id': 'django-logpipe',
},
# Optional Settings
# 'KAFKA_SEND_TIMEOUT': 10,
# 'KAFKA_MAX_SEND_RETRIES': 0,
# 'MIN_MESSAGE_LAG_MS': 0,
# 'DEFAULT_FORMAT': 'json',
}