0

我有一个队列,它处理一些通过 JSON 发送的“产品”。我以 {1, 2, 3, 4} 之类的顺序接收它们,但 resque 在 {1, 3, 2, 4} 中处理它们。他们订购的resque过程非常重要,因为旧版本Product可以覆盖已经处理过的新版本
有没有办法告诉resque process {job} orderede by {job.field_I_want}

编辑:排队工作的代码

def produto
        if params[:json]
#          upload = params[:json]
#          content = upload.read
#          parsed_json = JSON(content)

          parsed_json = JSON(params[:json])
          parsed_json['idFila'] = params[:idFila]

          logger.info parsed_json

          Resque.enqueue(ProdutoWorker, parsed_json)
          render json: ActiveSupport::JSON.encode(Retorno.new(:status => "OK", :mensagem => "Produto recebido")), :status => :ok
        else
          render json: ActiveSupport::JSON.encode(Retorno.new(:status => "Erro", :mensagem => "Sem JSON")), :status => :not_found
        end

        rescue => exception
          render json: ActiveSupport::JSON.encode(Retorno.new(:status => "Erro", :mensagem => "#{exception}")), :status => :error
      end #Produto
4

1 回答 1

0

resque 按照排队的顺序处理作业,您可以发布使作业排队的代码吗?

于 2012-06-04T19:45:09.217 回答