We have a Laravel API with a MariaDB database where we are having the issue of duplicate records in the database that are created by concurrent requests.

We assumed that implementing a queue would solve this, by handling one request at a time. But we still have the same issue of duplicate records.

In the application we have a check that looks for duplicates, but of course that won't work for concurrent requests that will create the same record at the same time.

We are unable to use a unique constraint at database level, partially because of Laravel's soft delete mechanism, and partially because of complex business logic that should allow duplicates if the value of one of the fields matches a certain set of values.

We use Redis as the queue driver.

Are we wrong by thinking that the queue should prevent these issues? Or did we somehow made a mistake somewhere implementing the queue?

This is a simplified version of the controller:

class CreateRecordJob extends Job implements SelfHandling

    public function __construct(array $data)
        $this->data = $data;

    public function handle()
        $data = $this->data;

        // check if we have this record in the database already
        if(!$this->hasDuplicate($data)) {

In config/queue.php we have set Redis as the default queue driver:

'default' => env('QUEUE_DRIVER', 'redis'),

And also in config/queue.php we have this for the redis connection:

'redis' => [
    'driver'     => 'redis',
    'connection' => 'default',
    'queue'      => 'default',
    'expire'     => 60,
dongping9475 好吧,我刚尝试过,将它包装在一个事务中仍然会产生重复。
大约 2 年之前 回复
dtqu72830 默认情况下,如果失败,它将被回滚。除非它是逻辑的一部分,否则您不需要手动执行此操作。你只关心提交交易。
大约 2 年之前 回复
doutuoben6908 那么什么时候应该回滚交易?通常我在处理多个表时使用事务,如果保存到其中一个表失败则回滚。但在这种情况下,问题是它会节省。
大约 2 年之前 回复
drd2551 你一定要试一试。这是交易的完美案例。
大约 2 年之前 回复
doulun1939 如果请求稍后发出,hasDuplicate可以正常工作。并且唯一索引不是当前业务逻辑的选项。@ChrisCynarski只有1个表参与此事,在这种情况下会有一笔交易帮助我吗?
大约 2 年之前 回复
dpowt82802 只有在应用不正确时简单的“检查是否存在,如果不存在则插入”是事务保持一致性的完美案例。否则,您可以检查该记录在其他进程刚刚创建时不存在。如果它不存在,进程号1将创建它,创建一个副本。
大约 2 年之前 回复
dqe9657 并发请求的db事务可能是死锁的原因
大约 2 年之前 回复
dougan5772 队列不会阻止创建具有相同数据的两个作业。看起来像hasDuplicate函数不能正常工作。我建议:1。检查hasDuplicate是否正常工作。2.通过在第一行中添加\DB::beginTransaction()并在handle()方法的最后一行添加\DB::commit()来执行检查和注入事务。3.在数据库中的一个或多个字段上创建唯一索引。这很大程度上取决于你的逻辑。
大约 2 年之前 回复


基本上 - 不是

laravel有接口Illuminate \ Console \ Scheduling \ Mutex为此目的,byt yuo需要扩展queueManager才能使用它</ p>
</ div>



basicly - not
you may find implementation of FIFO-compatable queue-drivers laravel has interface Illuminate\Console\Scheduling\Mutex for this purposes, byt yuo need to extend queueManager to use it

dongtuoao7987 amazon sqs有“消息重复数据删除ID”,这可能有所帮助
大约 2 年之前 回复
dpr81047 这就是队列无法解决问题的原因。
大约 2 年之前 回复
drrvnbwle80177811 你可以启动任意数量的工人,但互斥锁适用于1台服务器=(
大约 2 年之前 回复
doujia6503 如果你有一个工人,那么工作就会一个接一个地运行。 如果后续作业中的数据相同,这将无济于事。 如果工作正常,我会看看hasDuplicate方法,或者首先是重复数据的原因。
大约 2 年之前 回复
Csdn user default icon
laravel 队列执行保存数据,会重复插入数据?

我在laravel5.7队列中执行一条保存数据的操作,但我数据库里面出现了两条一模一样的数据,这是什么情况啊? ![图片说明]( ![图片说明]( 循环的原始数据是没有重复的,是什么原因导致->save()重复添加了两条数据的啊? 而且这个问题是偶发性的,执行这个队列多次,有时候不会出现这个问题,而有的时候又会出现这个问题 ![图片说明](


<div class="post-text" itemprop="text"> <p>I'm attempting to implement <a href="" rel="noreferrer">Laravel 5.7's queue job rate limiting</a> which for use when queue jobs hit an external API that's rate limited. </p> <p>Here's my job:</p> <pre><code> public function handle() { echo 'about to check throttling'.PHP_EOL; Redis::throttle('throttle-test')-&gt;allow(10)-&gt;every(5)-&gt;then(function () { // this is never executed echo 'doing work'.PHP_EOL; }, function () { // also never executed echo 'released back onto queue'.PHP_EOL; return $this-&gt;release(10); }); } </code></pre> <p>There's no mention of needing to use Redis for queues, cache or anything of that nature in the docs, aside from "...application can interact with a Redis server." Either way, here's my env vars:</p> <pre><code>DB_CONNECTION=mysql CACHE_DRIVER=file SESSION_DRIVER=file QUEUE_DRIVER=sync REDIS_HOST=redis </code></pre> <p>I've confirmed the <code>RedisServiceProvider</code> is receiving the correct configuration it expects:</p> <pre><code>array:3 [ "client" =&gt; "predis" "default" =&gt; array:4 [ "host" =&gt; "redis" "password" =&gt; null "port" =&gt; "6379" "database" =&gt; 0 ] "horizon" =&gt; array:5 [ "host" =&gt; "redis" "password" =&gt; null "port" =&gt; "6379" "database" =&gt; 0 "options" =&gt; array:1 [ "prefix" =&gt; "horizon:" ] ] ] </code></pre> <p>I'm struggling to understand why there's no runtime errors, it's just that nothings get executed. If I comment out the throttle stuff the job runs fine and does what it's supposed to do. <strong>What am I missing about the requirements to use this throttling?</strong></p> </div>

Laravel队列 - 将数据传递到队列

<div class="post-text" itemprop="text"> <p>I have an array containing about ~8,000 stock tickers that I'm trying to queue up; the queue is meant to receive the array of stock tickers ($symbols[]), and then pass each one to a worker / consumer (whichever jargon you prefer). </p> <p>Here's what my QueueController current looks like:</p> <pre><code>Class QueueController extends \BaseController { public function stocks() { $symbols = $this-&gt;select_symbols(); Queue::push('StockQueue', array('symbols' =&gt; $symbols)); } ... } </code></pre> <p>From my QueueController, I'm calling a method to retrieve the list of stock symbols and passing it to the StockQueue Class as the $data.</p> <pre><code>public function fire($job, $data) { $symbols = $data; // print_r shows all symbols... // Get Quote Data for Symbol $quote = $this-&gt;yql_get_quote($symbol); // Get Key Stats for Symbol $keystats = $this-&gt;yql_get_keystats($symbol); // Merge Quote and Keystats into an Array $array[] = $quote; $array[] = $keystats; // Save Data to DB $this-&gt;yql_save_results($array, $symbol); $job-&gt;delete(); } </code></pre> <p>This is not what I'm trying to achieve though; what I need to do is pass in each symbol, one by one, to the StockQueue Class, and have it process it as a task.</p> <p>If I were to wrap the StockQueue-&gt;stocks() method in a while loop, it would try and pass all ~8,000 in (from what I understand) immediately to the queue. Would this be detrimental or is this the best way to do it? I haven't been able to find a lot of examples for PHP-based RPC Message Queuing online, so I'm just as curious about the best practices as I am on the correct process.</p> <p>With that being said, how can I fire up multiple workers for this queue? Say, I want 5 workers (depending on how many resources each one takes; I'll figure that out) to process these tasks in order to reduce the processing time by ~4/5ths. How would I do that?</p> <p>Would I just launch <code>php artisan queue:listen</code> five times?</p> <p>And, for clarity, I'm using beanstalkd and supervisord to do the message queue / monitoring.</p> <p>I look forward to your advice and insight. </p> </div>


<div class="post-text" itemprop="text"> <p>I have a system with multiple web servers behind a load balancer. I also have one or more servers for running queued jobs (each server can also have more than one queue listener). The web servers push jobs on to redis (separate server) and the workers pull the jobs.</p> <p>I'm trying to find the best way to update the code (git pull) in each of these locations without the workers having failed jobs due to code changes. An example would be removing a dependency. Queued jobs would still rely on the "old" code after running git pull. Thus, the job would error out since the dependency was removed.</p> <p>Does anyone have insight on updating the queue workers without causing jobs to fail? </p> </div>

什么是Laravel队列连接和onQueue方法? [关闭]

<div class="post-text" itemprop="text"> <p>I just finished to read laravel documentation about queues and I dont understand somethings.</p> <ol> <li><p>What are these queues connections ?<br> What they do?<br> What is the difference between 'beanstalkd' , 'sqs', 'iron' and 'redis' ? </p></li> <li><p>What <code>onQueue</code> method does?<br> I read that you can with named queues tou can categorize the workers, but what the workers are? jon classes?<br> For what it's good? </p></li> </ol> </div>


<div class="post-text" itemprop="text"> <p>I'm want to queue some jobs using Redis,so I made an Event and its Listener.</p> <p>The Listener implements ShouldQueue. I deliberately throw exception to test whether it fails. By entering the the command <code>php artisan queue:work --tries=3</code> it should try the job 3 times and if it can't be done, add it to failed-jobs right? but it doesn't do so. I tried using database driver but nothing changed.</p> <p>One time I used <code>php artisan queue:work --tries=3 --daemon</code> despite the fact that <code>--daemon</code> is deprecated, and after 3 tries,the job was marked as failed - but when I stopped the command and ran it again, it didn't fail again.</p> <p>why is this happening? Thanks in advance :)</p> </div>

Laravel 5.2队列 - 延迟不起作用

<div class="post-text" itemprop="text"> <p>I need your help.</p> <p>I'm working with Laravel queue and with Linux supervisor tool (Exactly like it the documentation) </p> <p>Now I have a very weird issue. </p> <p>When I use this command without delay</p> <pre><code>$job = (new SendAutoresponderEmail($poptin,$autoresponder,$data)); </code></pre> <p>It's working fine. </p> <p>But when I use the delay option</p> <pre><code>$job = (new SendAutoresponderEmail($poptin,$autoresponder,$data))-&gt;delay(60); </code></pre> <p>The job failed and not continue anymore</p> <p>I can see the job on my failed-job table.</p> <p>Now... When I'm not working with the supervisor tool and just run the command in my terminal:</p> <pre><code>php artisan queue:listen </code></pre> <p>The command with the delay option and other queue task working fine.</p> <p>This is my larave-worker content look like:</p> <pre><code>[program:laravel-worker] process_name=%(program_name)s_%(process_num)02d command=php /var/www/html/Poptin/artisan queue:work database --sleep=3 --tries=3 --daemon autostart=true autorestart=true user=ubuntu numprocs=2 redirect_stderr=true stdout_logfile=/var/www/html/&lt;project&gt;/worker.log </code></pre> <p>What you think I need to do in order to fix it? </p> <p>Also ... How can I use a different queue for a different job? like that</p> <pre><code>$job = (new SendAutoresponderEmail($poptin,$autoresponder,$data))-&gt;onQueue('autoresponder')-&gt;delay(60); </code></pre> <p>?</p> <p>currently, I have only the default queue. Where I declare others queues in my config/queue.php file?</p> <pre><code>'connections' =&gt; [ 'sync' =&gt; [ 'driver' =&gt; 'sync', ], 'database' =&gt; [ 'driver' =&gt; 'database', 'table' =&gt; 'jobs', 'queue' =&gt; 'default', 'expire' =&gt; 60, ], </code></pre> </div>


<div class="post-text" itemprop="text"> <p>I have an issue with the Laravel queue. It will start processing jobs, but then it hangs somewhere in the middle (based on custom echos to the log) and ends only with timeout. The problem is that the job should take no more than 1 min, but the job in the queue runs for more than 10 mins without any results nor any errors - except the standard timeout error.</p> <h3>The job</h3> <p>The job that should be processed in the queue is containing standard Eloquent selection and one update method that should update the other model's property.</p> <pre class="lang-php prettyprint-override"><code>// app\Listeners\CountReceivedTextAnswers // There follows the listener's handle method. Nothing else is inside the // Listener, it also implements ShouldQueue interface and InteractsWithQueue trait. public function handle($event) { $questions = $this-&gt;question-&gt;whereTarget(['gl', 'povinn', 'ucit'], $event-&gt;evaluation-&gt;id, 'text'); $this-&gt;evaluation-&gt;updateOptions( $event-&gt;evaluation-&gt;id, 'number_of_answers_to_text_questions', $this-&gt;answer-&gt;countAnswersToManyQuestions($questions) ); } // app\Repositories\Answers\AnswersEloquentRepository // This is the method that is called inside the listener. It passes // collection of questions to the following method which should count // answers on them. public function countAnswersToManyQuestions(Collection $questions): int { $result = 0; foreach ($questions as $question) { $result += $this-&gt;countAnswersToQuestion($question); } return $result; } // This is the count method, it accepts Question model and count // number of answers received on that question. public function countAnswersToQuestion(Question $question): int { $select = [ 'id', 'import_id', 'question_id', 'content', 'value', 'hidden', 'hidden_by', 'signed_by', ]; return Answer::select($select) -&gt;whereDoesntHave('answered') -&gt;where('question_id', '=', $question-&gt;id) // Remove unwanted answers e.g. empty. -&gt;when($question-&gt;form === 'text', function (Builder $query) { $query-&gt;whereNotNull('content'); }) -&gt;when($question-&gt;form === 'slider', function (Builder $query) { $query-&gt;whereNotNull('value'); }) -&gt;count(); } // app\Repositories\Evaluation\EvaluationEloquentRepository // This is the update method that is called to update the value // inside the listener. public function updateOptions($id, $field, $value) { $evaluation = $this-&gt;find($id); $options = json_decode($evaluation-&gt;options, true); $options[$field] = $value; return $this-&gt;update($id, [ 'options' =&gt; $options ]); } </code></pre> <p>When I call the same method from listener manually in Tinker it takes around 30 sec to complete. Thus I guess the problem should not be related to the method itself, but something else, possibly configuration?</p> <h3>My setup</h3> <p>I'm using docker with five containers, two are based on my <a href="" rel="nofollow noreferrer">docker image</a> (<a href="" rel="nofollow noreferrer">.dockerfile</a>) which is based on the official php:7.3-fpm image with installed oci8 and few other extensions. The container's start script is based on this <a href="" rel="nofollow noreferrer">tutorial</a> so I can use one container for both - the queue and the app. The rest of the containers are base on their official docker images - httpd:2.4-alpine, mysql:8.0 and redis:5-alpine. I should also note that I'm using <strong>Laravel 5.5</strong></p> <p><strong>php.ini</strong></p> <p>These values I change in php.ini configuration. Rest should be default. It is set to be a quite generous, because at first I thought the error is related to php config, however is seems not, because there is no error in php's error log.</p> <pre><code>date.timezone=UTC display_errors=on log_errors=On error_log=/var/www/storage/logs/php.log opcache.enable=1 opcache.enable_cli=1 memory_limit = 512M upload_max_filesize = 128M post_max_size = 64M max_execution_time=900 max_input_time=900 default_socket_timeout=60 </code></pre> <p><strong></strong></p> <pre class="lang-sh prettyprint-override"><code>#!/usr/bin/env bash set -e role=${CONTAINER_ROLE:-app} env=${APP_ENV:-production} if [[ "$env" != "local" ]]; then echo "Caching configuration..." (cd /var/www &amp;&amp; php artisan config:cache &amp;&amp; php artisan route:cache &amp;&amp; php artisan view:cache) fi if [[ "$role" = "app" ]]; then exec php-fpm elif [[ "$role" = "queue" ]]; then echo "Running the queue..." php /var/www/artisan queue:listen --verbose --tries=10 --sleep=0 --timeout=800 --memory=512 elif [[ "$role" = "scheduler" ]]; then while [[ true ]] do php /var/www/artisan schedule:run --verbose --no-interaction &amp; sleep 60 done else echo "Could not match the container role \"$role\"" exit 1 fi </code></pre> <p><br></p> <h3>The only error</h3> <p>There is the only error, that I'm able to find in laravel.log, however I don't think that the actual problem is in the length of the job as running it in Tinker takes far less time than the timeout is set to be.</p> <blockquote> <p>[2019-05-22 16:06:39] local.ERROR: The process "'/usr/local/bin/php' 'artisan' queue:work 'redis' --once --queue='default' --delay=0 --memory=512 --sleep=0 --tries=10" exceeded the timeout of 800 seconds. {"exception":"[object] (Symfony\Component\Process\Exception\ProcessTimedOutException(code: 0): The process \"'/usr/local/bin/php' 'artisan' queue:work 'redis' --once --queue='default' --delay=0 --memory=512 --sleep=0 --tries=10\" exceeded the timeout of 800 seconds. at /var/www/vendor/symfony/process/Process.php:1335) [stacktrace] /var/www/vendor/symfony/process/Process.php(424): Symfony\Component\Process\Process-&gt;checkTimeout() /var/www/vendor/symfony/process/Process.php(212): Symfony\Component\Process\Process-&gt;wait() /var/www/vendor/laravel/framework/src/Illuminate/Queue/Listener.php(193): Symfony\Component\Process\Process-&gt;run(Object(Closure)) /var/www/vendor/laravel/framework/src/Illuminate/Queue/Listener.php(115): Illuminate\Queue\Listener-&gt;runProcess(Object(Symfony\Component\Process\Process), '512') /var/www/vendor/laravel/framework/src/Illuminate/Queue/Console/ListenCommand.php(68): Illuminate\Queue\Listener-&gt;listen('redis', 'default', Object(Illuminate\Queue\ListenerOptions)) [internal function]: Illuminate\Queue\Console\ListenCommand-&gt;handle() /var/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array) /var/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() /var/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure)) /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(549): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL) /var/www/vendor/laravel/framework/src/Illuminate/Console/Command.php(183): Illuminate\Container\Container-&gt;call(Array) /var/www/vendor/symfony/console/Command/Command.php(255): Illuminate\Console\Command-&gt;execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle)) /var/www/vendor/laravel/framework/src/Illuminate/Console/Command.php(170): Symfony\Component\Console\Command\Command-&gt;run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle)) /var/www/vendor/symfony/console/Application.php(960): Illuminate\Console\Command-&gt;run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) /var/www/vendor/symfony/console/Application.php(255): Symfony\Component\Console\Application-&gt;doRunCommand(Object(Illuminate\Queue\Console\ListenCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) /var/www/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application-&gt;doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) /var/www/vendor/laravel/framework/src/Illuminate/Console/Application.php(88): Symfony\Component\Console\Application-&gt;run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(121): Illuminate\Console\Application-&gt;run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) /var/www/artisan(35): Illuminate\Foundation\Console\Kernel-&gt;handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) {main} "} </p> </blockquote> <p><br></p> <p>I have tried probably all possible advices that I've found on internet, I have changed all values in the <code>php artisan queue:listen</code> command and also in <code>php.ini</code> but it always ends with the same outcome. I have also tried to locate redis log, but without success, thus I moved the queue to the database and the result was always the same. Queue listener started the job, but then somehow hanged without any further information or error. <strong>I shuld also say that the worker with all these listeners and jobs works very well outside docker images.</strong></p> <p>I will be very grateful for any advice or tip! Also if you'd like to see more information, please let me know, I'll add them.</p> </div>


<div class="post-text" itemprop="text"> <p>So currently I have some REST-API based on laravel, and I'm using queue laravel jobs with redis, to send a CURL when the request is done and I get the response, I want to retry this queue if the response doesn't same as I expected, like </p> <pre><code>if($response-&gt;status != true){ //retry this JOBS } </code></pre> <p>I try to throw an exception but it's wrong because I have handler if I got an exception, then I force to send response json which means force stop the process.</p> <p>So, how can I retry the jobs?</p> </div>

Laravel 5检查队列:在Windows上运行

<div class="post-text" itemprop="text"> <p>I send email on my script with laravel queue.<br> I need to run <code>php artisan queue:work</code> on my script for run laravel queue. I want to monitor if this <code>php artisan queue:work</code> failed, I run again. My solution is command like this on corn job</p> <pre><code>class Kernel extends ConsoleKernel { protected function schedule(Schedule $schedule) { if(check queue failed) $schedule-&gt;command("php artisan queue:work")-&gt;cron("* * * * *"); } } </code></pre> <p>I have two question<br> 1- what condition I should use instead of <code>check queue failed</code><br> 2- Is there any better solution?</p> </div>

laravel 事件推送到指定队列问题

laravel 版本 5.2 我想将我的某个事件推送到指定队列中,应该怎么写?


<div class="post-text" itemprop="text"> <p>Hi I have a laravel job as follows:</p> <pre><code>namespace App\Jobs; use Illuminate\Bus\Queueable; use Illuminate\Queue\SerializesModels; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use Timeline\Timeline; class testQueue implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; /** * Create a new job instance. * * @return void */ public function __construct() { // } /** * Execute the job. * * @return void */ public function handle(Timeline $timeline, $tag) { $tagData = $timeline-&gt;getTagFeed($tag)-&gt;getRankedItems(); if ($tagData) { echo "boom"; } } } </code></pre> <p>I'm running it via a route as follows:</p> <pre><code>Route::get('/queue', function () { $timeline= new Timeline(); $timeline-&gt;login("test", "testpwd"); Queue::later(5, new testQueue($timeline, "Testtag")); }); </code></pre> <p>Then on the commandline I ran:</p> <pre><code>php artisan queue:listen database </code></pre> <p>However, that one job is running 255 times instead of 1 times and exiting successfully.</p> <p>What am I doing wrong?</p> </div>


<div class="post-text" itemprop="text"> <p>I have a mission-critical queue in laravel 5.4 which is powerd by Redis and 8 workers on supervisor.</p> <p>In this queue, I have to make delayed jobs with a delay about 4 hours like this:</p> <pre><code> $job = (new VerifyAndOrderJob($books)) -&gt;onQueue('orders') -&gt;delay(\Carbon::now()-&gt;addHours(4)); dispatch($job); </code></pre> <p>Now since Laravel queues are based on FIFO, If I have thousands of delayed jobs like this in the queue everyday and I wanted to push a same job but without any delay, is it need to wait till other delayed jobs to be processed or this will be fired instantly?</p> </div>


<div class="post-text" itemprop="text"> <p>I have a 'proposal' table on my database, each proposal's row will generate a photo album (for all users) on certain time.</p> <p>I set a queue to generate per photo album, so there's a thousand jobs in my jobs table at database.</p> <p>to generate 1 photo album takes 4-10 seconds because there's an algorythm process.</p> <p>I create 8 proposals, so the last photo album will take a long time to be generated, could someone have a solution for me?</p> <p>Is there a way to create a multiple queue connection that run in the same time? lets say i have 5 proposal, so there's 5 queue connection, so each proposal has it's queue connection so the generate process will be done on time.</p> <p>Thank you.</p> </div>

Laravel 5.1中的队列错误

<div class="post-text" itemprop="text"> <p>I recently Created a job class by the command php artisan make:job --queued and I dispatched it from the controller and it worked fine , and I deleted it again because I don't need it anymore , and I already did an Event class for sending Emails and it's also queued (and worked fine before creating Job Class) the problem now when I trigger php artisan queue:listen I got this Error</p> <blockquote> <p>[InvalidArgumentException] <br> No handler registered for command [__PHP_Incomplete_Class]</p> </blockquote> <p>and everything was working fine before I created the job class So What's the problem ?Help me please Note: I use the database queue Driver</p> </div>


<div class="post-text" itemprop="text"> <p>I have set up my Laravel application to retrieve messages from an SQS queue. Everything works fine during normal operation: Messages are added to the queue when a queueable job is dispatched, and the queue worker grabs the message from SQS and runs the job successfully.</p> <p>However, I run into problems whenever I use the "View Messages" feature in the SQS web console. Here are the steps to reproduce:</p> <ul> <li>Go into the SQS web console</li> <li>Select the queue</li> <li>Run "View Messages" to get a live view of messages coming in</li> <li>After a while, stop polling</li> <li>Messages that were being intercepted are now released</li> <li>Queue worker grabs the messages but they all end up as failed jobs</li> <li>Run artisan queue:retry all</li> <li>Failed jobs now run successfully</li> </ul> <p>Why is this happening? I'm running Laravel 5.2.41 on PHP 5.6.</p> </div>


<div class="post-text" itemprop="text"> <p>I am working on queue job in Laravel v4.2 project and I have five queue worker to perform different type of jobs in queues and each worker has more than 500 jobs at the same time. For queue job I am using redis server and supervisor to process automatically. Now problem that I am facing is that supervisor process one job at a time and another job process after completing the first queue job. Now I want to process more than one job at the same time and for this purpose I search on google and forums too but failed to find correct answer below is my command that I am running to run queue jobs through supervisor</p> <pre><code>command=php /home/rizwan/php/webservices/local/artisan queue:listen --queue=notificationQueue,lowQueue --tries=1 command=php /home/rizwan/php/Fayvo/favyo_webservices/local/artisan queue:listen --tries=1 </code></pre> <p>if I remove priority param from command then queue jobs does not process which is wrong and if I add it then it process notificationQueue jobs first and then lowQueue jobs after processing all the jobs of notificationQueue jobs but I want to process both jobs at same time.</p> <p>supervisor configuration</p> <pre><code>redirect_stderr=true autostart=true autorestart=true numprocs = 4 process_name = %(program_name)s%(process_num)s user=rizwan </code></pre> </div>


<div class="post-text" itemprop="text"> <p>I'm trying to set up a table in order to asynchronously execute jobs in Laravel. I've already written the job class and can dispatch it. However it is dispatching synchronously.</p> <p>Following the <a href="" rel="nofollow noreferrer">documentation</a> When I attempt to create the migration with <code>php artisan queue:table</code> I receive the following error:</p> <pre><code>[Symfony\Component\Console\Exception\CommandNotFoundException] Command "queue:table" is not defined. Did you mean one of these? queue:failed queue:work queue:restart queue:listen queue:retry queue:forget queue:flush </code></pre> <p>I noticed I didn't initially have a queue.php file in the config directory so I added the one from the <a href="" rel="nofollow noreferrer">repository</a> and changed <code>'default' =&gt; env('QUEUE_DRIVER', 'sync')</code> to <code>'default' =&gt; env('QUEUE_DRIVER', 'database'),</code>;</p> <p>I also changed <code>QUEUE_DRIVER=sync</code> to <code>QUEUE_DRIVER=database</code> in my .env file. </p> <p>I'm new to job queues in Laravel so I'm not sure what I'm missing. How can I create the migration to utilize the database queue driver?</p> <p>UPDATE: I wound up just creating a jobs table in the postgres db I'm using for the rest of my data following the structure described in the <a href="" rel="nofollow noreferrer">Lumen documentation</a> and using that to store jobs but still curious why the <code>queue:table</code> function isn't available.</p> <p><em>Laravel Framework version Lumen (5.3.3) (Laravel Components 5.3.*)</em></p> </div>


<div class="post-text" itemprop="text"> <p>I have a legacy API written in Laravel, and I'm attempting to post data to it from a RabbitMQ queue. I'm using a third party library to integrate RabbitMQ into the native Laravel Queue architecture. Which works well, and is handling messages correctly when the listener console command is running. </p> <p>However, when I pass the following event, including the job and data keys, which are required by the queue handler... </p> <pre><code>{"job":"SixtyFiveContrib\\Jobs\\CreateSubmissionMetaDataJob@handle","data":{"title":"","story":"Testing 123","author":"Ewan Valentine","email":"","address":"","dob":"","phone":"","site":"The Lad Bible","legal":"The LAD bible - Facebook","agreed":false,"signature":"","files":[{"filename":"test.png","filesize":0,"filetype":""}],"agreement":{"id":"","facebook_id":""},"attempts":1036}} </code></pre> <p>I notice the class which handles queued events, splits the class path and the method name (SixtyFiveContrib\Jobs\CreateSubmissionMetaDataJob and handle), and attempts to call that class from the container. </p> <p>However jobs aren't automatically part of the container. When I attempt to add the job into the container myself, I run into a situation where I can't dynamically pass the 'data' from the queue into the job, for example... </p> <pre><code>$this-&gt;app-&gt;bind(\SixtyFiveContrib\Jobs\CreateSubmissionMetaDataJob::class, function() { return \SixtyFiveContrib\Jobs\CreateSubmissionMetaDataJob(????); }); </code></pre> <p>If I omit this entry from the container, the queue handler can no longer resolve the job, I get the following <strong>error...</strong> </p> <blockquote> <p>[Illuminate\Contracts\Container\BindingResolutionException]<br> Unresolvable dependency resolving [Parameter #0 [ $data ]] in class SixtyFiveContrib\Jobs\CreateSubmissionMetaDataJob</p> </blockquote> <p>Here's my job class (sensitive business logic omitted). </p> <pre><code>&lt;?php namespace SixtyFiveContrib\Jobs; use App; use Illuminate\Queue\SerializesModels; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Bus\SelfHandling; use Illuminate\Contracts\Queue\ShouldQueue; use SixtyFiveContrib\Jobs\Job; /** * CreateSubmissionsMetaDataJob * * @author Ewan Valentine &lt;; * @copyright The LAD bible Group - 2016 */ class CreateSubmissionMetaDataJob extends Job implements SelfHandling { use InteractsWithQueue, SerializesModels; /** * @var array $data */ public $data; /** * __construct * * @param array $this-&gt;data */ public function __construct($data) { $this-&gt;data = $data; } public function handle() { try { // Omitted } catch (\Exception $e) { \Log::error($e-&gt;getMessage() . " " . $e-&gt;getLine()); return $e-&gt;getMessage(); } } } </code></pre> </div>

2019 AI开发者大会

2019 AI开发者大会(AI ProCon 2019)是由中国IT社区CSDN主办的AI技术与产业年度盛会。多年经验淬炼,如今蓄势待发:2019年9月6-7日,大会将有近百位中美顶尖AI专家、知名企业代表以及千余名AI开发者齐聚北京,进行技术解读和产业论证。我们不空谈口号,只谈技术,诚挚邀请AI业内人士一起共铸人工智能新篇章!


实验内容: 通过对具体的文件存储空间的管理、文件的物理结构、目录结构和文件操作的实现,加深对文件系统内部功能和实现过程的理解。 要求: 1.在内存中开辟一个虚拟磁盘空间作为文件存储器,在其上实现一个简



2019数学建模A题高压油管的压力控制 省一论文即代码




Git 实用技巧

这几年越来越多的开发团队使用了Git,掌握Git的使用已经越来越重要,已经是一个开发者必备的一项技能;但很多人在刚开始学习Git的时候会遇到很多疑问,比如之前使用过SVN的开发者想不通Git提交代码为什么需要先commit然后再去push,而不是一条命令一次性搞定; 更多的开发者对Git已经入门,不过在遇到一些代码冲突、需要恢复Git代码时候就不知所措,这个时候哪些对 Git掌握得比较好的少数人,就像团队中的神一样,在队友遇到 Git 相关的问题的时候用各种流利的操作来帮助队友于水火。 我去年刚加入新团队,发现一些同事对Git的常规操作没太大问题,但对Git的理解还是比较生疏,比如说分支和分支之间的关联关系、合并代码时候的冲突解决、提交代码前未拉取新代码导致冲突问题的处理等,我在协助处理这些问题的时候也记录各种问题的解决办法,希望整理后通过教程帮助到更多对Git操作进阶的开发者。 本期教程学习方法分为“掌握基础——稳步进阶——熟悉协作”三个层次。从掌握基础的 Git的推送和拉取开始,以案例进行演示,分析每一个步骤的操作方式和原理,从理解Git 工具的操作到学会代码存储结构、演示不同场景下Git遇到问题的不同处理方案。循序渐进让同学们掌握Git工具在团队协作中的整体协作流程。 在教程中会通过大量案例进行分析,案例会模拟在工作中遇到的问题,从最基础的代码提交和拉取、代码冲突解决、代码仓库的数据维护、Git服务端搭建等。为了让同学们容易理解,对Git简单易懂,文章中详细记录了详细的操作步骤,提供大量演示截图和解析。在教程的最后部分,会从提升团队整体效率的角度对Git工具进行讲解,包括规范操作、Gitlab的搭建、钩子事件的应用等。 为了让同学们可以利用碎片化时间来灵活学习,在教程文章中大程度降低了上下文的依赖,让大家可以在工作之余进行学习与实战,并同时掌握里面涉及的Git不常见操作的相关知识,理解Git工具在工作遇到的问题解决思路和方法,相信一定会对大家的前端技能进阶大有帮助。


原价169,限时立减100元! 系统掌握Python核心语法16点,轻松应对工作中80%以上的Python使用场景! 69元=72讲+源码+社群答疑+讲师社群分享会&nbsp; 【哪些人适合学习这门课程?】 1)大学生,平时只学习了Python理论,并未接触Python实战问题; 2)对Python实用技能掌握薄弱的人,自动化、爬虫、数据分析能让你快速提高工作效率; 3)想学习新技术,如:人工智能、机器学习、深度学习等,这门课程是你的必修课程; 4)想修炼更好的编程内功,优秀的工程师肯定不能只会一门语言,Python语言功能强大、使用高效、简单易学。 【超实用技能】 从零开始 自动生成工作周报 职场升级 豆瓣电影数据爬取 实用案例 奥运冠军数据分析 自动化办公:通过Python自动化分析Excel数据并自动操作Word文档,最终获得一份基于Excel表格的数据分析报告。 豆瓣电影爬虫:通过Python自动爬取豆瓣电影信息并将电影图片保存到本地。 奥运会数据分析实战 简介:通过Python分析120年间奥运会的数据,从不同角度入手分析,从而得出一些有趣的结论。 【超人气老师】 二两 中国人工智能协会高级会员 生成对抗神经网络研究者 《深入浅出生成对抗网络:原理剖析与TensorFlow实现》一书作者 阿里云大学云学院导师 前大型游戏公司后端工程师 【超丰富实用案例】 0)图片背景去除案例 1)自动生成工作周报案例 2)豆瓣电影数据爬取案例 3)奥运会数据分析案例 4)自动处理邮件案例 5)github信息爬取/更新提醒案例 6)B站百大UP信息爬取与分析案例 7)构建自己的论文网站案例


深度学习系列课程从深度学习基础知识点开始讲解一步步进入神经网络的世界再到卷积和递归神经网络,详解各大经典网络架构。实战部分选择当下最火爆深度学习框架PyTorch与Tensorflow/Keras,全程实战演示框架核心使用与建模方法。项目实战部分选择计算机视觉与自然语言处理领域经典项目,从零开始详解算法原理,debug模式逐行代码解读。适合准备就业和转行的同学们加入学习! 建议按照下列课程顺序来进行学习 (1)掌握深度学习必备经典网络架构 (2)深度框架实战方法 (3)计算机视觉与自然语言处理项目实战。(按照课程排列顺序即可)


一 专题从基础的C语言核心到c++ 和stl完成基础强化; 二 再到数据结构,设计模式完成专业计算机技能强化; 三 通过跨平台网络编程,linux编程,qt界面编程,mfc编程,windows编程,c++与lua联合编程来完成应用强化 四 最后通过基于ffmpeg的音视频播放器,直播推流,屏幕录像,




文章目录Java概述何为编程什么是Javajdk1.5之后的三大版本JVM、JRE和JDK的关系什么是跨平台性?原理是什么Java语言有哪些特点什么是字节码?采用字节码的最大好处是什么什么是Java程序的主类?应用程序和小程序的主类有何不同?Java应用程序与小程序之间有那些差别?Java和C++的区别Oracle JDK 和 OpenJDK 的对比基础语法数据类型Java有哪些数据类型switc...



Vue.js 2.0之全家桶系列视频课程

基于新的Vue.js 2.3版本, 目前新全的Vue.js教学视频,让你少走弯路,直达技术前沿! 1. 包含Vue.js全家桶(vue.js、vue-router、axios、vuex、vue-cli、webpack、ElementUI等) 2. 采用笔记+代码案例的形式讲解,通俗易懂




第三十一问: 说一下线程中sleep()和wait()区别? 1 . sleep()是让正在执行的线程主动让出CPU,当时间到了,在回到自己的线程让程序运行。但是它并没有释放同步资源锁只是让出。 2.wait()是让当前线程暂时退让出同步资源锁,让其他线程来获取到这个同步资源在调用notify()方法,才会让其解除wait状态,再次参与抢资源。 3. sleep()方法可以在任何地方使用,而wait()只能在同步方法或同步块使用。 ...

java jdk 8 帮助文档 中文 文档 chm 谷歌翻译

JDK1.8 API 中文谷歌翻译版 java帮助文档 JDK API java 帮助文档 谷歌翻译 JDK1.8 API 中文 谷歌翻译版 java帮助文档 Java最新帮助文档 本帮助文档是使用谷





Visual Assist X 破解补丁

vs a's'sixt插件 支持vs2008-vs2019 亲测可以破解,希望可以帮助到大家


【为什么学爬虫?】 &nbsp; &nbsp; &nbsp; &nbsp;1、爬虫入手容易,但是深入较难,如何写出高效率的爬虫,如何写出灵活性高可扩展的爬虫都是一项技术活。另外在爬虫过程中,经常容易遇到被反爬虫,比如字体反爬、IP识别、验证码等,如何层层攻克难点拿到想要的数据,这门课程,你都能学到! &nbsp; &nbsp; &nbsp; &nbsp;2、如果是作为一个其他行业的开发者,比如app开发,web开发,学习爬虫能让你加强对技术的认知,能够开发出更加安全的软件和网站 【课程设计】 一个完整的爬虫程序,无论大小,总体来说可以分成三个步骤,分别是: 网络请求:模拟浏览器的行为从网上抓取数据。 数据解析:将请求下来的数据进行过滤,提取我们想要的数据。 数据存储:将提取到的数据存储到硬盘或者内存中。比如用mysql数据库或者redis等。 那么本课程也是按照这几个步骤循序渐进的进行讲解,带领学生完整的掌握每个步骤的技术。另外,因为爬虫的多样性,在爬取的过程中可能会发生被反爬、效率低下等。因此我们又增加了两个章节用来提高爬虫程序的灵活性,分别是: 爬虫进阶:包括IP代理,多线程爬虫,图形验证码识别、JS加密解密、动态网页爬虫、字体反爬识别等。 Scrapy和分布式爬虫:Scrapy框架、Scrapy-redis组件、分布式爬虫等。 通过爬虫进阶的知识点我们能应付大量的反爬网站,而Scrapy框架作为一个专业的爬虫框架,使用他可以快速提高我们编写爬虫程序的效率和速度。另外如果一台机器不能满足你的需求,我们可以用分布式爬虫让多台机器帮助你快速爬取数据。 &nbsp; 从基础爬虫到商业化应用爬虫,本套课程满足您的所有需求! 【课程服务】 专属付费社群+每周三讨论会+1v1答疑


功能描述:包括用户的登录注册,以及个人资料的修改.商品的分类展示,详情,加入购物车,生成订单,到银行支付等!另外还有收货地址的和我的收藏等常用操作.环境(JDK 1.7 ,mysql 5.5,Ecli


&nbsp; &nbsp; &nbsp; &nbsp; 本课程为Python数据挖掘方向的入门课程,课程主要以真实数据为基础,详细介绍数据挖掘入门的流程和使用Python实现pandas与numpy在数据挖掘方向的运用,并深入学习如何运用scikit-learn调用常用的数据挖掘算法解决数据挖掘问题,为进一步深入学习数据挖掘打下扎实的基础。


图像处理和计算机视觉的课程大家已经看过很多,但总有“听不透”,“用不了”的感觉。课程致力于创建人人都能听的懂的计算机视觉,通过生动、细腻的讲解配合实战演练,让学生真正学懂、用会。 【超实用课程内容】 课程内容分为三篇,包括视觉系统构成,图像处理基础,特征提取与描述,运动跟踪,位姿估计,三维重构等内容。课程理论与实战结合,注重教学内容的可视化和工程实践,为人工智能视觉研发及算法工程师等相关高薪职位就业打下坚实基础。 【课程如何观看?】 PC端: 移动端:CSDN 学院APP(注意不是CSDN APP哦) 本课程为录播课,课程2年有效观看时长,但是大家可以抓紧时间学习后一起讨论哦~ 【学员专享增值服务】 源码开放 课件、课程案例代码完全开放给你,你可以根据所学知识,自行修改、优化 下载方式:电脑登录,点击右下方课程资料、代码、课件等打包下载


本课程内容系统、全面、简洁、通俗易懂,通过2个多小时的介绍,让大家对软件测试有个系统的理解和认识,具备基本的软件测试理论基础。 主要内容分为5个部分: 1 软件测试概述,了解测试是什么、测试的对象、原则、流程、方法、模型;&nbsp; 2.常用的黑盒测试用例设计方法及示例演示;&nbsp; 3 常用白盒测试用例设计方法及示例演示;&nbsp; 4.自动化测试优缺点、使用范围及示例‘;&nbsp; 5.测试经验谈。


课程主要面向嵌入式Linux初学者、工程师、学生 主要从一下几方面进行讲解: 1.linux学习路线、基本命令、高级命令、vi及vim入门讲解 3.软件安装下载、NFS、Samba、FTP等服务器配置及使用

2019 Python开发者日-培训


快速入门Android开发 视频 教程 android studio

这是一门快速入门Android开发课程,顾名思义是让大家能快速入门Android开发。 学完能让你学会如下知识点: Android的发展历程 搭建Java开发环境 搭建Android开发环境 Android Studio基础使用方法 Android Studio创建项目 项目运行到模拟器 项目运行到真实手机 Android中常用控件 排查开发中的错误 Android中请求网络 常用Android开发命令 快速入门Gradle构建系统 项目实战:看美图 常用Android Studio使用技巧 项目签名打包 如何上架市场




这是一个门针对零基础学员学习微信小程序开发的视频教学课程。课程采用腾讯官方文档作为教程的唯一技术资料来源。杜绝网络上质量良莠不齐的资料给学员学习带来的障碍。 视频课程按照开发工具的下载、安装、使用、程序结构、视图层、逻辑层、微信小程序等几个部分组织课程,详细讲解整个小程序的开发过程

相关热词 c# 不能序列化继承类 c# char* 调用 c# 开发dll模板 c#添加控件到工具箱 c#控制台组合数 编程计算猴子吃桃问题c# c# wpf 背景透明 随机抽取号码软件c# c# 开发环境 c# 属性和字段