2017-12-25 12 views
0
// 
    // Summary: 
    //  Asynchronously send a single message to the broker. Refer to Confluent.Kafka.Producer`2.ProduceAsync(System.String,`0,`1,System.Int32,System.Boolean) 
    //  for more information. 
    // 
    // Remarks: 
    //  The partition the message is produced to is determined using the configured partitioner. 
    //  Blocks if the send queue is full. Warning: if background polling is disabled 
    //  and Poll is not being called in another thread, this will block indefinitely. 
    public Task<Message<TKey, TValue>> ProduceAsync(string topic, TKey key, TValue val); 
    // 
    // Summary: 
    //  Asynchronously send a single message to the broker. 
    // 
    // Parameters: 
    // topic: 
    //  The target topic. 
    // 
    // partition: 
    //  The target partition (if -1, this is determined by the partitioner configured 
    //  for the topic). 
    // 
    // key: 
    //  the message key (possibly null if allowed by the key serializer). 
    // 
    // val: 
    //  the message value (possibly null if allowed by the value serializer). 
    // 
    // blockIfQueueFull: 
    //  Whether or not to block if the send queue is full. If false, a KafkaExcepion 
    //  (with Error.Code == ErrorCode.Local_QueueFull) will be thrown if an attempt is 
    //  made to produce a message and the send queue is full. Warning: blockIfQueueFull 
    //  is set to true, background polling is disabled and Poll is not being called in 
    //  another thread, this will block indefinitely. 
    // 
    // Returns: 
    //  A Task which will complete with the corresponding delivery report for this request. 
    // 
    // Remarks: 
    //  If you require strict ordering of delivery reports to be maintained, you should 
    //  use a variant of ProduceAsync that takes an IDeliveryHandler parameter, not a 
    //  variant that returns a Task<Message> because Tasks are completed on arbitrary 
    //  thread pool threads and can be executed out of order. 
    public Task<Message<TKey, TValue>> ProduceAsync(string topic, TKey key, TValue val, int partition, bool blockIfQueueFull); 
    // 
    // Summary: 
    //  Asynchronously send a single message to the broker. Refer to Confluent.Kafka.Producer`2.ProduceAsync(System.String,`0,`1,System.Int32,System.Boolean) 
    //  for more information. 
    // 
    // Remarks: 
    //  Blocks if the send queue is full. Warning: if background polling is disabled 
    //  and Poll is not being called in another thread, this will block indefinitely. 
    public Task<Message<TKey, TValue>> ProduceAsync(string topic, TKey key, TValue val, int partition); 
    // 
    // Summary: 
    //  Asynchronously send a single message to the broker. Refer to Confluent.Kafka.Producer`2.ProduceAsync(System.String,`0,`1,System.Int32,System.Boolean) 
    //  for more information. 
    // 
    // Remarks: 
    //  The partition the message is produced to is determined using the configured partitioner. 
    public Task<Message<TKey, TValue>> ProduceAsync(string topic, TKey key, TValue val, bool blockIfQueueFull); 

documentは、スレッドセーフで安全でないことを示していません。ProduceAsyncConfluent.Kafka.Producer <TKey、TValue> .ProduceAsyncはスレッドセーフですか?

スレッドセーフですか?

答えて

0

はい、それはクライアント上ですべての操作

では(いくつかの小さな例外を除いて APIに記載)は、スレッドセーフです。

私の知る限り、そのような方法は、C#クライアント(または唯一の内部/プライベートメソッド)にまだ存在しない

https://github.com/confluentinc/confluent-kafka-dotnet/wiki/Client-Creation

https://github.com/edenhill/librdkafka/wiki/FAQ#is-the-library-thread-safe
関連する問題