Beispiel #1
0
    async def start(self, output: Queue) -> None:
        msg = proto.ConnectToPersistentSubscription()
        msg.subscription_id = self.name
        msg.event_stream_id = self.stream
        msg.allowed_in_flight_messages = self.max_in_flight

        await output.put(
            OutboundMessage(
                self.conversation_id,
                TcpCommand.ConnectToPersistentSubscription,
                msg.SerializeToString(),
                self.credential,
            ))
Beispiel #2
0
async def test_connect_request():

    output = TeeQueue()
    convo = ConnectPersistentSubscription("my-subscription",
                                          "my-stream",
                                          max_in_flight=57)
    await convo.start(output)
    [request] = output.items

    payload = proto.ConnectToPersistentSubscription()
    payload.ParseFromString(request.payload)

    assert request.command == TcpCommand.ConnectToPersistentSubscription
    assert payload.subscription_id == "my-subscription"
    assert payload.event_stream_id == "my-stream"
    assert payload.allowed_in_flight_messages == 57