Skip to content

GRPC

Spout for gRPC

Bases: Spout

__init__(output, state, **kwargs)

Initialize the Grpc class.

Parameters:

Name Type Description Default
output StreamingOutput

An instance of the StreamingOutput class for saving the data.

required
state State

An instance of the State class for maintaining the state.

required
**kwargs

Additional keyword arguments.

{}

Using geniusrise to invoke via command line

genius Grpc rise \
    streaming \
        --output_kafka_topic grpc_test \
        --output_kafka_cluster_connection_string localhost:9094 \
    none \
    listen \
        --args server_address=localhost:50051 request_data=my_request syntax=proto3

Using geniusrise to invoke via YAML file

version: "1"
spouts:
    my_grpc_spout:
        name: "Grpc"
        method: "listen"
        args:
            server_address: "localhost:50051"
            request_data: "my_request"
            syntax: "proto3"
        output:
            type: "streaming"
            args:
                output_topic: "grpc_test"
                kafka_servers: "localhost:9094"

listen(server_address, request_data, syntax, certificate=None, client_key=None, client_cert=None)

📖 Start listening for data from the gRPC server.

Parameters:

Name Type Description Default
server_address str

The address of the gRPC server.

required
request_data str

Data to send in the request.

required
syntax str

The syntax to be used (e.g., "proto3").

required
certificate Optional[str]

Optional server certificate for SSL/TLS.

None
client_key Optional[str]

Optional client key for SSL/TLS.

None
client_cert Optional[str]

Optional client certificate for SSL/TLS.

None

Raises:

Type Description
grpc.RpcError

If there is an error while processing gRPC messages.