[ 
https://issues.apache.org/jira/browse/KAFKA-398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13410916#comment-13410916
 ] 

Guozhang Wang commented on KAFKA-398:
-------------------------------------

In 0.7 SocketServer, the handler can only take the readin buffer as the 
parameter. However, to handle RegisterConsumer request, the coordinator needs 
to remember the map of the consumer id string to processor id, and then to the 
specific key. In 0.8 SocketServer handlers can take the request object which 
contains the key as the metadata, which makes recording the key possible.

Currently I hacked the SocketServer so that at the 
handleRegisterConsumerRequest procedure, it records the (consumerId, 
processorId) in the coordinator, and each processor keeps the (consumerId, key) 
itself. Then when the coordinator needs to send a request to certain consumer, 
it first finds the processor which maintains that channel from its map, sends 
its request to the processor, and then the processor will finds its 
corresponding key from its own map, and then atttach the request and set the 
flag WRITABLE.
                
> Enhance SocketServer to Enable Sending Requests
> -----------------------------------------------
>
>                 Key: KAFKA-398
>                 URL: https://issues.apache.org/jira/browse/KAFKA-398
>             Project: Kafka
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 0.8
>            Reporter: Guozhang Wang
>              Labels: features
>
> Currently the SocketServer is only used for reactively receiving requests and 
> send responses but not used for pro-actively send requests and receive 
> responses. Hence it does not need to remember which channel/key correspond to 
> which consumer.
> On the other hand, there are cases such as consumer coordinator that needs 
> SocketServer to send requests and receive responses to the consumers.
> It would be nice to add this functionality such that an API can be called 
> with the id string and the request message, and the SocketServer will figure 
> out which channel to use and write that message to the key's attachment and 
> set the flag as WRITABLE so that the processor can then send it.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to