diff options
Diffstat (limited to 'kafka/protocol/api.py')
-rw-r--r-- | kafka/protocol/api.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/kafka/protocol/api.py b/kafka/protocol/api.py new file mode 100644 index 0000000..0c23437 --- /dev/null +++ b/kafka/protocol/api.py @@ -0,0 +1,16 @@ +from .struct import Struct +from .types import Int16, Int32, String, Schema + + +class RequestHeader(Struct): + SCHEMA = Schema( + ('api_key', Int16), + ('api_version', Int16), + ('correlation_id', Int32), + ('client_id', String('utf-8')) + ) + + def __init__(self, request, correlation_id=0, client_id='kafka-python'): + super(RequestHeader, self).__init__( + request.API_KEY, request.API_VERSION, correlation_id, client_id + ) |