增加RCU上离线功能,能耗双通道
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using BLWData.Entity;
|
||||
using Confluent.Kafka;
|
||||
using System.Text;
|
||||
using static Confluent.Kafka.ConfigPropertyNames;
|
||||
|
||||
namespace 消费
|
||||
@@ -8,9 +9,10 @@ namespace 消费
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
RunConsumers().Wait();
|
||||
ShengChan().Wait();
|
||||
//RunConsumers().Wait();
|
||||
Console.WriteLine("Hello, World!");
|
||||
Console.ReadKey();
|
||||
Console.ReadLine();
|
||||
|
||||
}
|
||||
|
||||
@@ -36,6 +38,25 @@ namespace 消费
|
||||
|
||||
//await StartConsumer(cts.Token);
|
||||
}
|
||||
async public static Task ShengChan()
|
||||
{
|
||||
var config = new ConsumerConfig
|
||||
{
|
||||
BootstrapServers = "172.16.4.132:19092",
|
||||
SecurityProtocol = SecurityProtocol.SaslPlaintext,
|
||||
SaslMechanism = SaslMechanism.Plain,
|
||||
SaslUsername = "blwmomo",
|
||||
SaslPassword = "blwmomo"
|
||||
|
||||
};
|
||||
var p = new ProducerBuilder<string, byte[]>(config).Build();
|
||||
|
||||
var bytes = Encoding.UTF8.GetBytes("Hello");
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
var dr = await p.ProduceAsync("test", new Message<string, byte[]> { Key = "abc", Value = bytes });
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task StartConsumer(CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user