Source code for faust.agents.models
"""Models used by agents internally."""
from faust.models import Record
from faust.types import K, ModelT
__all__ = ['ReqRepRequest', 'ReqRepResponse']
[docs]class ReqRepRequest(Record,
serializer='json',
namespace='@ReqRepRequest', # internal namespace
# any stream should allow this type
# to wrap other values.
allow_blessed_key=True):
"""Value wrapped in a Request-Reply request."""
# agent.ask(value) wraps the value in this record
# so that the receiving agent knows where to send the reply.
value: ModelT
reply_to: str
correlation_id: str
[docs]class ReqRepResponse(Record, serializer='json', namespace='@ReqRepResponse'):
"""Request-Reply response."""
key: K
value: ModelT
correlation_id: str