@@ -8,6 +8,7 @@ It has numerous use cases, including distributed logging, stream processing and
881 . [ Data streaming with Apache Kafka] ( https://developer.confluent.io/ )
992 . [ Kafka 101] ( https://developer.confluent.io/courses/apache-kafka/events/ )
10103 . [ How Kafka works] ( https://www.confluent.io/blog/apache-kafka-intro-how-kafka-works/ ) (Great!)
11+ 4 . [ confluent kafka dotnet examples] ( https://github.com/confluentinc/confluent-kafka-dotnet/tree/master/examples )
1112
1213## Terminology
1314### Event
@@ -105,6 +106,35 @@ Ashishs-MacBook-Pro:dotnet-kafka ashishkhanal$ dotnet new sln
105106### Add a console app as Consumer
106107<img width =" 450 " alt =" image " src =" https://github.com/akhanalcs/dotnet-kafka/assets/30603497/25394bc5-984c-4eaf-a071-3cb20a8fec59 " >
107108
109+ #### Setup appsettings.json
110+ [ Reference] ( https://learn.microsoft.com/en-us/dotnet/core/extensions/configuration#alternative-hosting-approach )
111+
112+ Install ` Microsoft.Extensions.Hosting ` package.
113+
114+ Add ` appsettings.json ` , and set these options:
115+ - Build action: Content
116+ - Copy to output directory: Copy if newer
117+
118+ And use it
119+ https://github.com/akhanalcs/dotnet-kafka/blob/2fb1f8c16f5b5fbee85caa1645b42940d8f670fb/Consumer/Program.cs#L3-L10
120+
121+ #### Use user-secrets to store API key and secret
122+ [ Reference] ( https://learn.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-8.0&tabs=windows#enable-secret-storage )
123+
124+ ``` bash
125+ dotnet user-secrets init
126+ ```
127+
128+ This command adds a ` UserSecretsId ` element, populated with a GUID, to the project file.
129+
130+ If you want the Producer to also access secrets pointed by this Id, copy this element into the Producer's project file as well.
131+
132+ Now you can store API keys and secrets in there without it being checked into source control.
133+
134+ Right click the project -> Tools -> [ .NET User Secrets] ( https://plugins.jetbrains.com/plugin/10183--net-core-user-secrets )
135+
136+ <img width =" 350 " alt =" image " src =" https://github.com/akhanalcs/dotnet-kafka/assets/30603497/507002f2-4517-45f6-b285-8b87a30e981f " >
137+
108138### Install dependencies
109139Manage Nuget Packages
110140
@@ -114,6 +144,11 @@ Install it in both projects
114144
115145<img width =" 850 " alt =" image " src =" https://github.com/akhanalcs/dotnet-kafka/assets/30603497/b85f2175-ac38-4a30-9588-190d444171ff " >
116146
147+ ## Install Java
148+ Go to [ Java Downloads] ( https://www.oracle.com/java/technologies/downloads/ ) and install the latest JDK. (JDK 21 as of Feb 2024).
149+
150+ [ TODO: Will come back to this later]
151+
117152## Local Kafka cluster setup
118153### Install confluent cli
119154``` bash
@@ -228,4 +263,20 @@ Home -> Environments -> default -> cluster_0 -> Cluster Settings -> Endpoints
228263## Configuration
229264Home -> Environments -> default -> cluster_0 -> API Keys -> Create key
230265
266+ <img width =" 550 " alt =" image " src =" https://github.com/akhanalcs/dotnet-kafka/assets/30603497/06aa5e29-ea4f-4727-abdf-4b00d92b0474 " >
267+
268+ ## Create Topic
269+ [ Reference] ( https://developer.confluent.io/courses/apache-kafka-for-dotnet/producing-messages-hands-on/#create-a-new-topic )
270+
271+ A topic is an immutable, append-only log of events. Usually, a topic is comprised of the same kind of events, e.g., in this guide we create a topic for retail purchases.
272+
273+ Create a new topic, purchases, which you will use to produce and consume events.
274+
275+ Home -> Environments -> default -> cluster_0 -> Topics -> Create topic
276+
277+ <img width =" 450 " alt =" image " src =" https://github.com/akhanalcs/dotnet-kafka/assets/30603497/12acfdb3-20a2-4a30-b781-cfe15512e318 " >
278+
279+
280+ - Truth: That comports to reality.
281+ - Maybe true there's a diamond shaped exactly like my head on MARS, but there's no way for us to know that. so we can't really say "oh it's true that there's diamon shaped my head in MARS"
231282
0 commit comments