Closed jklynch closed 4 years ago
Needs tests and docstrings, but I'm :+1: on this.
This is very common book keeping and in the grand scheme of things relatively cheap. I'm still meh on the stream name helper, but won't argue over it.
The latest commits have a proposal for a minimal change to RunRouter. The warning is still issued but the exception is re-raised.
This PR proposes two modifications to DocumentRouter:
deliver a warning if a DocumentRouter processes the same start document twice consecutively to address #164
add convenience methods to address #165
get_start()
returning the most recently processed start documentget_descriptor(event_doc)
returning the descriptor document corresponding to the specified event documentget_stream_name(event_doc)
returning the stream name for the specified event document; this seems like a minor convenience but it is the piece of information I very often want from a descriptorThe convenience methods are prefixed with
get_
since DocumentRouter already definesstart(name, doc)
anddescriptor(name, doc)
but some other naming scheme might be better.I realize now that the
event_doc
parameter forget_descriptor
andget_stream_name
should probably just bedoc
.