1 | #pragma once |
---|---|
2 | |
3 | #include <DataStreams/IBlockOutputStream.h> |
4 | #include <Interpreters/Context.h> |
5 | #include <Storages/Kafka/StorageKafka.h> |
6 | |
7 | namespace DB |
8 | { |
9 | |
10 | class KafkaBlockOutputStream : public IBlockOutputStream |
11 | { |
12 | public: |
13 | explicit KafkaBlockOutputStream(StorageKafka & storage_, const Context & context_); |
14 | ~KafkaBlockOutputStream() override; |
15 | |
16 | Block getHeader() const override; |
17 | |
18 | void writePrefix() override; |
19 | void write(const Block & block) override; |
20 | void writeSuffix() override; |
21 | |
22 | void flush() override; |
23 | |
24 | private: |
25 | StorageKafka & storage; |
26 | Context context; |
27 | ProducerBufferPtr buffer; |
28 | BlockOutputStreamPtr child; |
29 | }; |
30 | |
31 | } |
32 |