pyleus.json_fields_bolt

JSON-specialized Bolt component.

class pyleus.json_fields_bolt.JSONFieldsBolt(input_stream=None, output_stream=None)[source]

JSON-specialized SimpleBolt abstracting JSON-parsing and tuple processing from the actual application logic.

extract_fields(json_dict)[source]

Implement in a subclass to extract the desired fields from json_dict.

Parameters:json_dict (dict) – JSON object representing the input tuple value
Returns:a list of values, or None to emit nothing.
Return type:list or None

Note

Implement in subclass.

process_tuple(tup)[source]

Extract JSON representation of incoming tuple value and emit based on the result of extract_fields().

Note

Emitted tuples are automatically anchored.