Exemplo n.º 1
0
 private Task HandleFetchResponse(CommonAcknowledgement <FetchResponse> fetchResponse)
 {
     if (fetchResponse.Response.ThrottleTime > 0)
     {
         Throttled(fetchResponse.Response.ThrottleTime);
     }
     return(HandleResponse(fetchResponse.Response.FetchPartitionResponse, fetchResponse.ReceivedDate, HandleFetchPartitionResponse, IsPartitionOkForClients));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Acknowledge a response from an offset request. Will post a corresponding
 /// message to the inner actor.
 /// </summary>
 /// <param name="offsetResponse">an offset response from a Kafka broker.</param>
 public void Acknowledge(CommonAcknowledgement <CommonResponse <OffsetPartitionResponse> > offsetResponse)
 {
     _innerActor.Post(new ConsumerMessage
     {
         MessageType  = ConsumerMessageType.OffsetResponse,
         MessageValue = new ConsumerMessageValue
         {
             OffsetResponse = offsetResponse
         }
     });
 }
Exemplo n.º 3
0
 /// <summary>
 /// Acknowledge a response from a fetch request. Will post a corresponding
 /// message to the inner actor.
 /// </summary>
 /// <param name="fetchResponse">a fetch response from a Kafka broker.</param>
 public void Acknowledge(CommonAcknowledgement <FetchResponse> fetchResponse)
 {
     _innerActor.Post(new ConsumerMessage
     {
         MessageType  = ConsumerMessageType.FetchResponse,
         MessageValue = new ConsumerMessageValue
         {
             FetchResponse = fetchResponse
         }
     });
 }
Exemplo n.º 4
0
        /// <summary>
        /// Iterate over all partition responses. We refresh the metadata when a partition
        /// is in error.
        /// </summary>
        private async Task HandleResponse <TPartitionResponse>(CommonAcknowledgement <TPartitionResponse> acknowledgement,
                                                               Func <string, TPartitionResponse, Task> responseHandler, Func <TPartitionResponse, bool> partitionChecker)
            where TPartitionResponse : IMemoryStreamSerializable, new()
        {
            bool gotMetadata = false;

            foreach (var r in acknowledgement.Response.TopicsResponse)
            {
                foreach (var pr in r.PartitionsData)
                {
                    // Refresh metadata in case of error. We do this only once to avoid
                    // metadata request bombing.
                    if (!gotMetadata && acknowledgement.ReceivedDate > _routingTable.LastRefreshed && !partitionChecker(pr))
                    {
                        // TODO: factorize that with ProducerRouter code?
                        await EnsureHasRoutingTable();

                        gotMetadata = true;
                    }
                    await responseHandler(r.TopicName, pr);
                }
            }
        }
Exemplo n.º 5
0
 private Task HandleOffsetResponse(CommonAcknowledgement <CommonResponse <OffsetPartitionResponse> > offsetResponse)
 {
     return(HandleResponse(offsetResponse.Response, offsetResponse.ReceivedDate, HandleOffsetPartitionResponse, IsPartitionOkForClients));
 }
Exemplo n.º 6
0
 private Task HandleFetchResponse(CommonAcknowledgement <FetchPartitionResponse> fetchResponse)
 {
     return(HandleResponse(fetchResponse, HandleFetchPartitionResponse, IsPartitionOkForClients));
 }