RQEventEmitter
class¶
Bases: EventEmitter
An event emitter subclass that utilizes the Redis Queue system to handle the execution of event emissions.
Notes:
- This class uses a Redis Queue instance to enqueue event emissions, which are subsequently executed by Redis Queue workers. This approach provides a scalable and distributed method for handling the execution of event emissions.
Read more in the Pyventus docs for RQ Event Emitter.
Source code in pyventus/emitters/rq/rq_event_emitter.py
Functions¶
emit
¶
Emits an event and triggers its associated event handlers.
Notes:
- When emitting
dataclass
objects orException
objects, they are automatically passed to the event handler as the first positional argument, even if you pass additional*args
or**kwargs
. - If there are event handlers subscribed to the global event
...
, also known asEllipsis
, they will also be triggered each time an event or exception is emitted.
PARAMETER | DESCRIPTION |
---|---|
event
|
The event to be emitted. It can be
TYPE:
|
args
|
Positional arguments to be passed to the event handlers.
TYPE:
|
kwargs
|
Keyword arguments to be passed to the event handlers.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
None
|
None |
Source code in pyventus/emitters/event_emitter.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
|
__init__
¶
__init__(queue: Queue, options: Dict[str, Any] | None = None, event_linker: Type[EventLinker] = EventLinker, debug: bool | None = None) -> None
Initialize an instance of RQEventEmitter
.
PARAMETER | DESCRIPTION |
---|---|
queue
|
The Redis queue for enqueuing event handlers.
TYPE:
|
options
|
Additional options for the RQ package enqueueing method. Defaults to an empty dictionary.
TYPE:
|
event_linker
|
Specifies the type of event linker used to manage and access events along with their corresponding event handlers. Defaults to
TYPE:
|
debug
|
Specifies the debug mode for the logger. If
TYPE:
|