Skip to content

Commit e2001b8

Browse files
committed
c# consumer connected. :yay:
1 parent ff80892 commit e2001b8

File tree

3 files changed

+32
-9
lines changed

3 files changed

+32
-9
lines changed

docker-compose.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,11 @@ services:
3838
container_name: cdc-kafka
3939
image: debezium/kafka:1.6
4040
ports:
41-
- 9094:9094
41+
- 9092:9092
4242
environment:
4343
ZOOKEEPER_CONNECT: zookeeper:2181
44-
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT
45-
KAFKA_LISTENERS: INSIDE://:9092,OUTSIDE://127.0.0.1:9094
46-
KAFKA_ADVERTISED_LISTENERS: INSIDE://:9092,OUTSIDE://127.0.0.1:9094
47-
KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE
44+
ADVERTISED_LISTENER:
45+
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://host.docker.internal:9092
4846
depends_on:
4947
- zookeeper
5048
kafka-connect:

netcore/Models/Consumer.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
using Com.Hus.Cdc;
2-
using Confluent.Kafka;
1+
using Com.Hus.Cdc;
2+
using Confluent.Kafka;
33
using LiteDB;
4-
using Microsoft.Extensions.Configuration;
4+
using Microsoft.Extensions.Configuration;
55
using Microsoft.Extensions.Hosting;
66
using System;
77
using System.Threading;
@@ -18,7 +18,7 @@ public QuestionConsumerService()
1818
{
1919
var consumerConfig = new ConsumerConfig
2020
{
21-
BootstrapServers = "localhost:9094",
21+
BootstrapServers = "host.docker.internal:9092",
2222
GroupId = "hus-dotnet-consumer",
2323
AutoOffsetReset = AutoOffsetReset.Earliest
2424
};

netcore/netcore.sln

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.31613.86
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "netcore", "netcore.csproj", "{2A39F4EC-7286-4080-BE76-57C26C42258C}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{2A39F4EC-7286-4080-BE76-57C26C42258C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{2A39F4EC-7286-4080-BE76-57C26C42258C}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{2A39F4EC-7286-4080-BE76-57C26C42258C}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{2A39F4EC-7286-4080-BE76-57C26C42258C}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {6520A07C-2F91-4153-B364-53342C21307A}
24+
EndGlobalSection
25+
EndGlobal

0 commit comments

Comments
 (0)