#pragma once #include #include #include #include namespace DB { class RabbitMQBlockInputStream : public IBlockInputStream { public: RabbitMQBlockInputStream( StorageRabbitMQ & storage_, const StorageMetadataPtr & metadata_snapshot_, const std::shared_ptr & context_, const Names & columns, bool ack_in_suffix = true); ~RabbitMQBlockInputStream() override; String getName() const override { return storage.getName(); } Block getHeader() const override; void readPrefixImpl() override; Block readImpl() override; void readSuffixImpl() override; void updateChannel(); bool needManualChannelUpdate(); bool sendAck(); private: StorageRabbitMQ & storage; StorageMetadataPtr metadata_snapshot; const std::shared_ptr context; Names column_names; bool ack_in_suffix; bool finished = false; const Block non_virtual_header; const Block virtual_header; ConsumerBufferPtr buffer; }; }