Redis context¶
Redis is used for publishing processing events. Message is published to chanel ‘luna-sender:{account_id}’
in format msg_to_luna_sender
.
- class luna_handlers.redis_db.redis_context.BaseRedisContext(channelName='luna-sender', storageTime=None)[source]¶
Base class for Redis context.
- channelName¶
A string, redis channel prefix
- logger¶
A Logger
- storageTime¶
storage time (“UTC” or “LOCAL”)
- async publish(events, requestId)[source]¶
Publish events. Msg is published to channel ‘luna-sender:{account_id}’ in format:
msg_to_luna_sender
- Parameters:
events – events
requestId – request id
- Return type:
None
- async publishRawEvent(event, accountId, handlerId, requestId)[source]¶
Publish events. Msg is published to channel ‘luna-sender:{account_id}’ in format:
msg_to_luna_sender
- Parameters:
event – user raw event
accountId – account id
handlerId – handler id
requestId – request id
- Return type:
None
- class luna_handlers.redis_db.redis_context.RedisContext(host='127.0.0.1', port=6379, password=None, channelName='luna-sender', storageTime=None)[source]¶
Redis context
- connectionsPool¶
An instance of aioredis.ConnectionsPool
- channelName¶
A string, redis channel prefix
- host¶
redis host
- port¶
redis port
- password¶
redis password
- class luna_handlers.redis_db.redis_context.SentinelRedisContext(sentinels, masterName, redisPassword, channelName='luna-sender', storageTime=None)[source]¶
Redis context for installations with sentinel.
- sentinels¶
A List of tuples (host, port), addresses of sentinels
- sentinel¶
An instance of Sentinel interface
- masterName¶
A str, name of the redis master set
- channelName¶
A string, redis channel prefix
- connectionsPool¶
A aioredis.sentinel.ManagedPool, pool managed by sentinel