Template Class HttpServerSourceStage
Defined in File http_server_source_stage.hpp
Base Type
public mrc::pymrc::PythonSource< std::shared_ptr< OutputT > >
-
template<typename OutputT>
class HttpServerSourceStage : public mrc::pymrc::PythonSource<std::shared_ptr<OutputT>> -
Public Types
-
using base_t = mrc::pymrc::PythonSource<std::shared_ptr<OutputT>>
Public Functions
-
HttpServerSourceStage(std::string bind_address = "127.0.0.1", unsigned short port = 8080, std::string endpoint = "/message", std::string live_endpoint = "/live", std::string ready_endpoint = "/ready", std::string method = "POST", std::string live_method = "GET", std::string ready_method = "GET", unsigned accept_status = 201, float sleep_time = 0.1f, long queue_timeout = 5, std::size_t max_queue_size = 1024, unsigned short num_server_threads = 1, std::size_t max_payload_size = DefaultMaxPayloadSize, std::chrono::seconds request_timeout = std::chrono::seconds(30), bool lines = false, std::size_t stop_after = 0, std::unique_ptr<control_message_task_t> task = nullptr)
Constructor for the HttpServerSourceStage.
- Parameters
bind_address – The IP address to bind the server to
port – The TCP port to bind the server to
endpoint – The endpoint to listen for messages on
live_endpoint – The endpoint to check if the server is running
ready_endpoint – The endpoint to check if the server is ready to accept messages
method – The HTTP method to accept requests on the
endpoint
live_method – The HTTP method to accept requests on the
live_endpoint
ready_method – The HTTP method accept requests on the
ready_endpoint
accept_status – The HTTP status code to return when a message is accepted
sleep_time – The time to sleep when the queue is empty
queue_timeout – The time to wait for the queue to accept a message
max_queue_size – The maximum number of messages to queue prior to blocking incoming requests
num_server_threads – The number of threads to run the server on
max_payload_size – The maximum size of the payload
request_timeout – The time to wait for a request to complete
lines – If
false
, the HTTP server will expect each request to be a JSON array of objects. Iftrue
, the HTTP server will expect each request to be a JSON object per line.stop_after – The number of records to emit before stopping. Useful for testing, disabled if
0
.task – When
OutputT=ControlMessage
, optional task to be added to all outgoing messagess, triggers an assertion error for all other types.
-
inline ~HttpServerSourceStage() override
-
void close()
-
using base_t = mrc::pymrc::PythonSource<std::shared_ptr<OutputT>>