Redis pubsub¶
Spout for Redis pubsub
Bases: Spout
__init__(output, state, **kwargs)
¶
Initialize the RedisPubSub 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 RedisPubSub rise \
streaming \
--output_kafka_topic redis_test \
--output_kafka_cluster_connection_string localhost:9094 \
none \
listen \
--args channel=my_channel host=localhost port=6379 db=0
Using geniusrise to invoke via YAML file¶
listen(channel, host='localhost', port=6379, db=0, password=None)
¶
📖 Start listening for data from the Redis Pub/Sub channel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
channel |
str
|
The Redis Pub/Sub channel to listen to. |
required |
host |
str
|
The Redis server host. Defaults to "localhost". |
'localhost'
|
port |
int
|
The Redis server port. Defaults to 6379. |
6379
|
db |
int
|
The Redis database index. Defaults to 0. |
0
|
password |
Optional[str]
|
The password for authentication. Defaults to None. |
None
|
Raises:
Type | Description |
---|---|
Exception
|
If unable to connect to the Redis server. |