Skip to content

Commit 01e4b9a

Browse files
author
Matt Howlett
committed
updated examples in README.md
1 parent 88099fe commit 01e4b9a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class Program
9090
{
9191
public static async Task Main(string[] args)
9292
{
93-
var config = new Dictionary<string, object> { { "bootstrap.servers", "localhost:9092" } };
93+
var config = new ProducerConfig { BootstrapServers = "localhost:9092" };
9494

9595
// A Producer for sending messages with null keys and UTF-8 encoded values.
9696
using (var p = new Producer<Null, string>(config))
@@ -109,8 +109,8 @@ class Program
109109
}
110110
```
111111

112-
However, a server round-trip is slow (3ms at a minimum; actual latency depends on many factors).
113-
In highly concurrent scenarios you will get high overall throughput out of the producer using
112+
Note that a server round-trip is slow (3ms at a minimum; actual latency depends on many factors).
113+
In highly concurrent scenarios you will achieve high overall throughput out of the producer using
114114
the above approach, but there will be a delay on each `await` call. In stream processing
115115
applications, where you would like to process many messages in rapid succession, you would typically
116116
make use the `BeginProduce` method instead:
@@ -126,7 +126,7 @@ class Program
126126
{
127127
public static void Main(string[] args)
128128
{
129-
var conf = new Dictionary<string, object> { { "bootstrap.servers", "localhost:9092" } };
129+
var conf = new ProducerConfig { BootstrapServers = "localhost:9092" };
130130

131131
Action<DeliveryReportResult<Null, string>> handler = r =>
132132
Console.WriteLine(!r.Error.IsError
@@ -161,11 +161,11 @@ class Program
161161
{
162162
public static void Main(string[] args)
163163
{
164-
var conf = new Dictionary<string, object>
164+
var conf = new ConsumerConfig
165165
{
166-
{ "group.id", "test-consumer-group" },
167-
{ "bootstrap.servers", "localhost:9092" },
168-
{ "auto.offset.reset", "earliest" }
166+
GroupId = "test-consumer-group",
167+
BootstrapServers = "localhost:9092",
168+
AutoOffsetReset = AutoOffsetResetType.Earliest
169169
};
170170

171171
using (var c = new Consumer<Ignore, string>(conf))

0 commit comments

Comments
 (0)