Example #1
0
 def __reply(self, template, reason=None):
     """
     Sends a protocol reply message to the submitter
     """
     graph = build_reply(template, self.request.message_id, reason)
     reply(graph.serialize(format='turtle'), exchange=exchange,
           routing_key='{}.{}'.format(response_rk, self.request.submitted_by),
           **self.request.broker)
    def complete(self, fid, *args):
        sink = args[0]

        sink.lock.acquire()
        try:
            # At this point, the stream flag is disabled, and the delivery state might need to be updated
            sink.stream = False
            if sink.delivery == 'streaming':
                log.debug('Sending end stream signal after {}'.format(sink.delivery))
                sink.delivery = 'sent'
                reply((), headers={'state': 'end', 'format': 'tuple'}, **sink.recipient)
                log.info('Stream of fragment {} for request {} is done'.format(fid, sink.request_id))
        finally:
            sink.lock.release()
Example #3
0
 def deliver_message():
     reply(message, headers=headers, **response.sink.recipient)
     return len(str(message))