Laravel DatabaseQueue 基本知识点
来源:互联网 发布:中穆助手软件 编辑:程序博客网 时间:2024/06/01 10:44
基本知识点包括:Container; php serialize, deseriaize; json_encode, json_decode.
framework/src/Illuminate/Queue/DatabaseQueue.php
/** * Create a payload string from the given job and data. * * @param string $job * @param mixed $data * @param string $queue * @return string */ protected function createPayload($job, $data = '', $queue = null) { if ($job instanceof Closure) { return json_encode($this->createClosurePayload($job, $data)); } if (is_object($job)) { return json_encode([ 'job' => 'Illuminate\Queue\CallQueuedHandler@call', 'data' => ['commandName' => get_class($job), 'command' => serialize(clone $job)], ]); } return json_encode($this->createPlainPayload($job, $data)); }
framework/src/Illuminate/Queue/Jobs/Job.php
protected function resolveAndFire(array $payload) { list($class, $method) = $this->parseJob($payload['job']); $this->instance = $this->resolve($class); $this->instance->{$method}($this, $this->resolveQueueableEntities($payload['data'])); } /** * Parse the job declaration into class and method. * * @param string $job * @return array */ protected function parseJob($job) { $segments = explode('@', $job); return count($segments) > 1 ? $segments : [$segments[0], 'fire']; } /** * Resolve the given job handler. * * @param string $class * @return mixed */ protected function resolve($class) { return $this->container->make($class); } /** * Resolve all of the queueable entities in the given payload. * * @param mixed $data * @return mixed */ protected function resolveQueueableEntities($data) { if (is_string($data)) { return $this->resolveQueueableEntity($data); } if (is_array($data)) { $data = array_map(function ($d) { if (is_array($d)) { return $this->resolveQueueableEntities($d); } return $this->resolveQueueableEntity($d); }, $data); } return $data; } /** * Resolve a single queueable entity from the resolver. * * @param mixed $value * @return \Illuminate\Contracts\Queue\QueueableEntity */ protected function resolveQueueableEntity($value) { if (is_string($value) && Str::startsWith($value, '::entity::')) { list($marker, $type, $id) = explode('|', $value, 3); return $this->getEntityResolver()->resolve($type, $id); } return $value; }
0 0
- Laravel DatabaseQueue 基本知识点
- laravel框架知识点记录
- laravel重要概念和知识点
- laravel php 项目知识点总结
- laravel 基本数据操作
- 基本知识点
- 基本知识点
- 基本知识点
- 基本知识点
- laravel等框架基本流程
- laravel陌生知识点快速学习(一)
- laravel陌生知识点快速学习(二)
- laravel陌生知识点快速学习(三)
- laravel陌生知识点快速学习(四)
- laravel框架-任务调度-知识点总结
- PHP and laravel知识点小小积累
- 基本排序算法 - 基本知识点
- laravel(七)laravel自动生成基本注册登录功能
- 地图
- R调用C++函数
- 微信公众帐号开发 - 消息处理工具的封装及消息回复
- SQL数据表批量插入日期值(datetime类型)
- 温故而知新系列之Oracle 树操作
- Laravel DatabaseQueue 基本知识点
- Linux下yum配置
- Kettle6.1学习笔记
- SDM(supervised descent method)算法
- java 利用反射机制的刀实体类的属性以及对属性操作
- SVN/Git
- Depth Estimation and Deep Learning
- IDEA使用JDBC连接Mysql
- DOM操作