parameters: (self, msg, payload)
docstring: Process an inbound raw message.
docstring_summary: Process an inbound raw message.
docstring_tokens: Process an inbound raw message .
function: def process_raw(self, msg, payload):
          """Process an inbound raw message."""
          nats_error = {
              'error': '',
              'message': 'inbound mastodon message process failed'
          }
          nats_success = {
              'message': 'OK : inbound mastodon message proceeded'
          }
          try:
              user = User.get(payload['user_id'])
              identity = UserIdentity.get(user, payload['identity_id'])
              deliver = UserMastodonDelivery(user, identity)
              new_message = deliver.process_raw(payload['message_id'])
              nats_success['message_id'] = str(new_message.message_id)
              nats_success['discussion_id'] = str(new_message.discussion_id)
              self.natsConn.publish(msg.reply, json.dumps(nats_success))
          except DuplicateObject:
              log.info("Message already imported : {}".format(payload))
              nats_success['message_id'] = str(payload['message_id'])
              nats_success['discussion_id'] = ""  # message has not been parsed
              nats_success['message'] = 'raw message already imported'
              self.natsConn.publish(msg.reply, json.dumps(nats_success))
          except Exception as exc:
              # TODO: handle abort exception and report it as special case
              exc_info = sys.exc_info()
              log.error("deliver process failed for raw {}: {}".
                        format(payload, traceback.print_exception(*exc_info)))
              nats_error['error'] = str(exc.message)
              self.natsConn.publish(msg.reply, json.dumps(nats_error))
              return exc
function_tokens: def process_raw ( self , msg , payload ) : nats_error = { 'error' : '' , 'message' : 'inbound mastodon message process failed' } nats_success = { 'message' : 'OK : inbound mastodon message proceeded' } try : user = User . get ( payload [ 'user_id' ] ) identity = UserIdentity . get ( user , payload [ 'identity_id' ] ) deliver = UserMastodonDelivery ( user , identity ) new_message = deliver . process_raw ( payload [ 'message_id' ] ) nats_success [ 'message_id' ] = str ( new_message . message_id ) nats_success [ 'discussion_id' ] = str ( new_message . discussion_id ) self . natsConn . publish ( msg . reply , json . dumps ( nats_success ) ) except DuplicateObject : log . info ( "Message already imported : {}" . format ( payload ) ) nats_success [ 'message_id' ] = str ( payload [ 'message_id' ] ) nats_success [ 'discussion_id' ] = "" # message has not been parsed nats_success [ 'message' ] = 'raw message already imported' self . natsConn . publish ( msg . reply , json . dumps ( nats_success ) ) except Exception as exc : # TODO: handle abort exception and report it as special case exc_info = sys . exc_info ( ) log . error ( "deliver process failed for raw {}: {}" . format ( payload , traceback . print_exception ( * exc_info ) ) ) nats_error [ 'error' ] = str ( exc . message ) self . natsConn . publish ( msg . reply , json . dumps ( nats_error ) ) return exc