Exemplo n.º 1
0
def persistent_subscription_confirmed(conversation_id: UUID,
                                      subscription_id: str):
    payload = proto.PersistentSubscriptionConfirmation()
    payload.last_commit_position = 1
    payload.last_event_number = 1
    payload.subscription_id = subscription_id

    return msg.OutboundMessage(
        conversation_id,
        msg.TcpCommand.PersistentSubscriptionConfirmation,
        payload.SerializeToString(),
    )
Exemplo n.º 2
0
    def reply_from_init(self, response: InboundMessage, output: Queue):
        self.expect_only(TcpCommand.PersistentSubscriptionConfirmation, response)
        result = proto.PersistentSubscriptionConfirmation()
        result.ParseFromString(response.payload)

        self.subscription = PersistentSubscription(
            result.subscription_id,
            self.stream,
            self.conversation_id,
            result.last_commit_position,
            result.last_event_number,
            self.max_in_flight,
            output,
            self.auto_ack,
        )

        self.is_live = True
        self.result.set_result(self.subscription)
Exemplo n.º 3
0
async def confirm_subscription(convo,
                               commit=23,
                               event_number=56,
                               subscription_id="FUUBARRBAXX",
                               queue=None):

    response = proto.PersistentSubscriptionConfirmation()
    response.last_commit_position = commit
    response.last_event_number = event_number
    response.subscription_id = subscription_id

    await convo.respond_to(
        InboundMessage(
            convo.conversation_id,
            TcpCommand.PersistentSubscriptionConfirmation,
            response.SerializeToString(),
        ),
        queue,
    )