---
# System prepended metadata

title: dispatch vs dispatchNow vs dispatchSync
tags: [開發經驗分享]

---

# dispatch vs dispatchNow vs dispatchSync

dispatch:將任務送進隊列

dispatchNow:不進隊列，立即執行，意外時直接拋出Exception

dispatchSync:不進隊列，立即執行，新增failed處理異常，預設直接拋出Exception

   
## ref
[Synchronous Dispatching](https://laravel.com/docs/11.x/queues#dispatching-jobs)
[dispatchNow 與dispatchSync](https://laracasts.com/discuss/channels/laravel/dispatchnow-vs-dispatchsync?fbclid=IwAR3EmJ7C6RM72F0bp6IxnqA1CFZhEwbtzNmdJcB6NYIkfSc4xlelgJRZIuU_aem_AXGphO1ja5t9ItPWOll-LdPsG3aa0hudGj9pUFTLt25q_KRXG8VsRsFCL5DOIZYu4wX-2wGCqkBQTIK_jYde3b5D)


