async def reply(self, message: InboundMessage, output: Queue): result = self.response_cls() result.ParseFromString(message.payload) if result.result == self.result_type.Success: await self.success(result, output) elif result.result == self.result_type.NoStream: await self.error( exceptions.StreamNotFound(self.conversation_id, self.stream)) elif result.result == self.result_type.StreamDeleted: await self.error( exceptions.StreamDeleted(self.conversation_id, self.stream)) elif result.result == self.result_type.Error: await self.error( exceptions.ReadError(self.conversation_id, self.stream, result.error)) elif result.result == self.result_type.AccessDenied: await self.error( exceptions.AccessDenied( self.conversation_id, type(self).__name__, result.error, stream=self.stream, )) elif (self.result_type == ReadEventResult and result.result == self.result_type.NotFound): await self.error( exceptions.EventNotFound(self.conversation_id, self.stream, self.event_number))
async def reply(self, message: InboundMessage, output: Queue): result = proto.ReadAllEventsCompleted() result.ParseFromString(message.payload) if result.result == ReadAllResult.Success: await self.success(result, output) elif result.result == ReadAllResult.Error: await self.error( exceptions.ReadError(self.conversation_id, "$all", result.error)) elif result.result == ReadAllResult.AccessDenied: await self.error( exceptions.AccessDenied(self.conversation_id, type(self).__name__, result.error))
async def reply(self, message: InboundMessage, output: Queue) -> None: self.expect_only(TcpCommand.CreatePersistentSubscriptionCompleted, message) result = proto.CreatePersistentSubscriptionCompleted() result.ParseFromString(message.payload) if result.result == SubscriptionResult.Success: self.is_complete = True self.result.set_result(None) elif result.result == SubscriptionResult.AccessDenied: await self.error( exceptions.AccessDenied(self.conversation_id, type(self).__name__, result.reason)) else: await self.error( exceptions.SubscriptionCreationFailed(self.conversation_id, result.reason))