Laravel 5.8 Tutorial From Scratch - e29 - Queues: Database Driver

Поделиться
HTML-код
  • Опубликовано: 15 ноя 2024

Комментарии • 84

  • @rolanddecasa4438
    @rolanddecasa4438 3 года назад +1

    Thank you Maestro for making complex to simplex! Keep it up and stay safe!

  • @armkhachatryan4854
    @armkhachatryan4854 4 года назад

    Short, but clear. Looks like the best explanation of the Laravel Queues. Thank you !

  • @MarcHershey
    @MarcHershey 4 года назад +9

    People always ask me.. how did you learn laravel so fast?
    My answer is, dedicating my life to Coder's Tape. lol

  • @mohamedshuaau632
    @mohamedshuaau632 4 года назад +5

    You sound like a GTA Character. Absolutely Love it! And great Tut!

  • @thesparkdev6665
    @thesparkdev6665 4 года назад

    that's a great video! thanks a lot!
    btw what are some scenarios you would use Queues for?
    eaxmple: user verification email upon new sign up?

  • @pseudouser55
    @pseudouser55 3 года назад

    WOW that's a very simple and great tutorial
    Thank You!

  • @CODINGISEASY
    @CODINGISEASY 5 лет назад +1

    Nice video on queues. I prefer aws sqs or redis queue but I suppose they all do the same thing

  • @grbruno100
    @grbruno100 5 лет назад +1

    Thank Y for share your knowledge, I'm learning a lot with your videos!

  • @sheikhabdullah6574
    @sheikhabdullah6574 3 года назад

    This is a pretty nice video when you see that there are lot of other not so good Indian tutorials out there (please no offence) that explain in this detail

  • @_SoundByte_
    @_SoundByte_ 4 года назад

    Why do we add a delay time ? (any practical examples ?)

  • @shindytrimarialaxmi7687
    @shindytrimarialaxmi7687 Год назад

    Super nice tutorial👍

  • @frederikzutterman50
    @frederikzutterman50 5 лет назад +1

    Awsome video series but with this one I ran into an issue :
    ShouldQueue does not work for me.
    All the listeners do their tasks but when I add ShouldQueue all works identically the same as before.
    So the timer waits for 10 seconds and the mail coms into mailtrap.
    Nothing is added to my jobs table, but since there is a jobtable migrations have worked.
    I have changed my driver to database in the ENV file and I am using sqlite just as in your tutorial.
    I'm working on windows 10 with composer and installed nodejs package for the npm etc. as you have shown in previous videos of this series.
    Restaring php artisan server did not change anything.
    Running the same laravel with wamp running and php artisan server off had the identical result of skipping the Queue entirely.
    Any other suggestions I can try to make it work as intended?

    • @bonifacemunyuandege2229
      @bonifacemunyuandege2229 5 лет назад +5

      stop the server, then clear cache - php artisan config:cache then restart the server. anything that affects the .env file needs some cache clearing and restarting the server. that should work

  • @Mickelson050
    @Mickelson050 3 года назад +1

    Don't know if someone else got stuck with this but if it still takes a long time make sure to clear the cache using php artisan config cache

    • @bboydarknesz
      @bboydarknesz 3 года назад

      I do both, php artisan config:cache and config:clear, restart server and boom!

  • @julienSibille
    @julienSibille 5 лет назад +1

    Thanks sir !
    Something i'm not sure: In production is it Cron used to fire queue:work ?

    • @CodersTape
      @CodersTape  5 лет назад +1

      No. You need to install Supervisor to run that as a background process.

  • @kennethsmith9115
    @kennethsmith9115 5 лет назад +1

    I'm a bit confused on the jobs table. Are all jobs removed from the table once they have been executed?

    • @CodersTape
      @CodersTape  5 лет назад +1

      That’s correct. Jobs table is just a queue. Once the job gets processed, the entry is erased. If the job fails, there’s a failed jobs table.

    • @kennethsmith9115
      @kennethsmith9115 5 лет назад +1

      @@CodersTape Thanks so much for your prompt reply. This series is awesome.

  • @Codehunting
    @Codehunting 4 года назад +1

    Hi Coder's tape, great series ever. I have one error for jobs lecture
    [2019-12-23 12:28:34][22] Processing: App\Listeners\WelcomeNewCustomerListener
    [2019-12-23 12:28:34][22] Failed: App\Listeners\WelcomeNewCustomerListener
    i tried 22 times but it showing only this error again and again. Please tell me how to fix this.

  • @fahadakhtar65
    @fahadakhtar65 5 лет назад

    Hi coder tape in your tutorial series you can't teach how to connect our database to our table plus software.

  • @f22hd
    @f22hd 4 года назад

    Amazing, Thanks alot

  • @cosmicdioxide
    @cosmicdioxide 3 года назад

    thank you! it really helps a lot

  • @walidnaceri2802
    @walidnaceri2802 4 года назад

    I'm in love 😍 with laravel because of you hahaha, just a question please, do we need that sleep(10) function always?

    • @Stennwellara1
      @Stennwellara1 4 года назад +1

      No, don't use it. He just used it to simulate a slow mail server.

  • @mavbcn1790
    @mavbcn1790 4 года назад

    Thanks!
    Then I only need to use the "implements ShouldQueue" in a class to queue the methods inside it?

    • @cali4484
      @cali4484 4 года назад

      laravel.com/docs/8.x/queues#delayed-dispatching

  • @munnaahmed7859
    @munnaahmed7859 5 лет назад

    You're really awesome, i never seen before like you

  • @aksands9929
    @aksands9929 5 лет назад

    I can't thank you enough for the great course. I have a question: Can we control the order of listener handlers e.g (chain them based on their return results)?

    • @CodersTape
      @CodersTape  5 лет назад +1

      No but you can always fire new events in your listener to trigger other listeners. For example, you fire an event of GenerateBlahReportEvent, then you are calculating a big report and it takes 3 minutes to run the job. After you are done, you fire, ReportBlahHasCompletedEvent and it has its own set of listeners send an email for example.

    • @aksands9929
      @aksands9929 5 лет назад

      @@CodersTape GIANT THANKS! That should work too.... Great!

  • @inderjitsingh9634
    @inderjitsingh9634 5 лет назад +1

    How to do it on the production server please tell me i am new to it

    • @Yayna-o2d
      @Yayna-o2d 3 года назад

      Im facing the same issue here :/
      any fix please ?

  • @alzy101
    @alzy101 3 года назад

    it using database a bad idea in production? Why would using redis be the better solution?

  • @dotamovie1033
    @dotamovie1033 5 лет назад +3

    I got lost when you open the TablePlus app :( i'm zero knowledge here.

    • @CodersTape
      @CodersTape  5 лет назад

      Just showing you how it’s structured. For visualization only, no need for TablePlus

    • @salah.eddinemoustakim246
      @salah.eddinemoustakim246 5 лет назад +1

      just install tableplus and open the file database.sqlite (name_of_project/database/database.sqlite)

  • @mheltzel57
    @mheltzel57 5 лет назад +1

    @Frederik
    php artisan config:cache
    worked for me.
    L6.0

    • @uros.u.novakovic
      @uros.u.novakovic 5 лет назад

      Why not just reply to his comment. Making a new comment does nothing for him unless he goes through the comments manually. Replying sends him a notification.

    • @mheltzel57
      @mheltzel57 5 лет назад

      @@uros.u.novakovic
      Thanks .

  • @seochanid5501
    @seochanid5501 5 лет назад

    I'm not sure why but i need to use php artisan config:cache command and then restart the php artisan serve to make it work ^^a

  • @ashishsharma6724
    @ashishsharma6724 4 года назад

    please make a tutorial on the webhook server/client.

  • @creative-commons-videos
    @creative-commons-videos 4 года назад +1

    can you please explain the difference between events and jobs, both look same to me :)

    • @CodersTape
      @CodersTape  4 года назад +2

      The difference between an event and a job is that you can listen for an event and trigger certain tasks. So for example, Laravel actually fires many events internally and technically nothing happens. But you have the option to hook into those events and add your own logic. As a concrete example of that, Laravel fires events when saving, retrieving or updating records from the database. If you needed to perform something before inserting a record, you can listen for a saving event on the model and add that in. You can also fire your own custom events of course and optionally add listeners. This type of functionality is just not possible with jobs. Jobs are designed more for things like cron tasks. As an example of this, in one of my apps, I send a daily email at 9pm with a summary of that day's transactions. This is a job called DailyReportJob. There is no action (event) associated with this task, meaning that it's not tied into a specific event occurring in my app, so it's a job. Hope that clarifies it.

    • @creative-commons-videos
      @creative-commons-videos 4 года назад

      @@CodersTape great, thanks

  • @josephnduati1214
    @josephnduati1214 4 года назад

    The GOAT 🐐

  • @Yayna-o2d
    @Yayna-o2d 3 года назад

    I have a question everyone , does queue database work in production ? all my notitifications fails when i use queue:work :( on local everything is working like a charm.

    • @mmmsabeel
      @mmmsabeel 3 года назад

      were you able to find a solution?

  • @Aqibroker01
    @Aqibroker01 5 лет назад +1

    completed all the steps as you said, but still its not using queue,
    running the sleep() method and nothing found in jobs table

    • @CodersTape
      @CodersTape  5 лет назад

      Try restarting your serve command after rechecking the .env file

    • @Aqibroker01
      @Aqibroker01 5 лет назад

      @@CodersTape still it's not working,
      code of my ShouldQueue.php
      i think there's something wrong with it

    • @Aqibroker01
      @Aqibroker01 5 лет назад +1

      @@CodersTape the issue is resolve it was just
      php artisan config:cache
      but i dont know why i need to clear cache every time to perform some task

    • @hieunguyenac4675
      @hieunguyenac4675 5 лет назад +1

      @@Aqibroker01 I got same issue with you, thank u!

    • @Aqibroker01
      @Aqibroker01 5 лет назад

      @@hieunguyenac4675 issue with me :D

  • @giannizamora7247
    @giannizamora7247 5 лет назад

    quick question how do you link table plus to SQLite?

    • @giannizamora7247
      @giannizamora7247 5 лет назад

      Nvm found out how. Guys you can download tableplus, open app and click sqlite, then a window pops up saying enter name and select db. select DB opens up finder and is looking for a file. Go into your project root/database and click database.sqlite this should connect and you should see the databases

    • @CodersTape
      @CodersTape  5 лет назад

      @@giannizamora7247 Awesome! Thanks for sharing.

  • @SuperBlackBeto
    @SuperBlackBeto 5 лет назад

    I have this issue when i put php artisan queue:work
    [2019-09-22 22:55:01][7] Processing: App\Listeners\WelcomeNewStudentListener
    [2019-09-22 22:55:01][7] Failed: App\Listeners\WelcomeNewStudentListener
    Im using student instead of customers, all was fine until now, when i write the command above

  • @bywicked
    @bywicked 3 года назад

    Hello, enable subtitles please? Thank you!

  • @ayeniadedamola6207
    @ayeniadedamola6207 5 лет назад

    please how do i solve this port 127.0.0.1:8000/ is just loading and did not open my laravel project on chrome again

    • @CodersTape
      @CodersTape  5 лет назад

      Did your restarting the machine? Mac or PC?

    • @ayeniadedamola6207
      @ayeniadedamola6207 5 лет назад

      Is not a Mac.. window and do you mean i should restart the system

  • @samiulislam7839
    @samiulislam7839 5 лет назад

    is any way to run the queue job in the background without using the command " php artisan queue:work"

    • @CodersTape
      @CodersTape  5 лет назад +1

      You certainly can:
      To start the queue worker in the background, in the terminal run (with no quotes)
      "php artisan queue:work &"
      Then, that returns a Process ID (an identifier for that particular job)
      Using that PID you can terminate it with
      "KILL [enter PID here]"
      As an example
      "KILL 123456"
      If you forget the PID, you can find it by running
      "jobs -l"
      Hope that helps!

    • @CodersTape
      @CodersTape  5 лет назад +1

      Decided to put that on a video. Check out episode 30.

    • @samiulislam7839
      @samiulislam7839 5 лет назад

      @@CodersTape waiting for e30, You are Genius, the series is going on really good I have ever seen, waiting for next. It's like premium.

  • @adam192021
    @adam192021 5 лет назад

    The BEST as always!

  • @haseebanis9477
    @haseebanis9477 3 года назад

    you didn't tell us how to go from controller to job

  • @NazrulIslam-iz6sw
    @NazrulIslam-iz6sw 5 лет назад

    php artisan queue:work does not work for me.
    I code exactly as you do, I create an event and some listeners & connect them vai EventServiceProvider. It`s works fine but when I add queue, queue works but mail does not sent.
    my work processes :
    1. update .env file with =>QUEUE_CONNECTION=database
    2. implements ShouldQueue in listener
    3. create queue:table // it creates a jobs migration
    4. php artisan migrate:fresh
    5. php artisan queue:work
    If I create new customer, it creates a queue processing.. but after after sleep(5) work, it shows an error, failed
    All work fine but mail does not sent to mailtrap (without queue, mail sent successfully)
    Please let me know what i m missing?

    • @frederikzutterman50
      @frederikzutterman50 5 лет назад +1

      Could you please tell what the error is?

    • @NazrulIslam-iz6sw
      @NazrulIslam-iz6sw 5 лет назад

      @@frederikzutterman50 php artisan queue:work command does not work properly
      error is:
      [2019-09-22 22:55:01][7] Processing: App\Listeners\WelcomeNewStudentListener
      [2019-09-22 22:55:01][7] Failed: App\Listeners\WelcomeNewStudentListener

    • @AshishKashyap-zq8ws
      @AshishKashyap-zq8ws 4 года назад +1

      @@NazrulIslam-iz6sw just run php artisan config:cache and restart your server your code will work

  • @santiagos4290
    @santiagos4290 3 года назад

    hey, i'm Walking HERE

  • @mochamadrivan8758
    @mochamadrivan8758 5 лет назад

    I keep Failing on inserting queue to jobs DB.. why is that??
    anyway it's a cool Video.. thanks.

    • @CodersTape
      @CodersTape  5 лет назад +1

      You may need to stop and restart your php artisan serve

    • @mochamadrivan8758
      @mochamadrivan8758 5 лет назад

      @@CodersTape I had restart it, yet it still doesn't inserted. is 5.8 that different with 5.7?

    • @CodersTape
      @CodersTape  5 лет назад

      Nothing was changed from 5.7 to 5.8 in that regard

    • @mochamadrivan8758
      @mochamadrivan8758 5 лет назад

      @@CodersTape Thanks, I follow Ur tutorial again and found out the problem was from the passed parameter.

  • @latlov
    @latlov 4 года назад

    6:20 recap