Page History
...
Code Block | ||
---|---|---|
| ||
var producerAkkaOption = new ProducerAkkaOption() { BootstrapServers = "webnori-kafka.servicebus.windows.net:9093", ProducerName = "webnori-kafka", SecuritOption = new KafkaSecurityOption() { SecurityProtocol = SecurityProtocol.SaslSsl, SaslMechanism = SaslMechanism.Plain, SaslUsername = "$ConnectionString", SaslPassword = "Endpoint=sb://webnori-kafka.servicebus.windows.net/;SharedAccessKeyName=kafka-client;SharedAccessKey=PfL0qRUm50AXZHRXLiVfnatIRI3OqAh+dT6Owsqrd2M=", SslCaLocation = "./cacert.pem" } }; string producerActorName = "producerActor"; var producerActor= AkkaLoad.RegisterActor(producerActorName /*AkkaLoad가 인식하는 유니크명*/, actorSystem.ActorOf(Props.Create(() => new ProducerActor(producerAkkaOption)), producerActorName /*AKKA가 인식하는 Path명*/ )); producerActor.Tell(new BatchData() { Data = new KafkaTextMessage() { Topic = "akka100", Message = "testData" } }); |
샘플 코드 : 액터모델로 작성될시 장점은, AkkaStream과 연동하여 속도조절기,버퍼방지등 여러가지 유용한 장치를 끝단에 연결할수 있기때문입니다.
- 활용하기 : https://github.com/psmon/AkkaDotModule/blob/master/AkkaDotBootApi/Test/TestAkka.cs
- 실구현체 : https://github.com/psmon/AkkaDotModule/blob/master/AkkaDotModule/ActorUtils/Confluent/ProducerActor.cs
...