imamuseum/harvester2

在线收藏数据收割机的第二个版本。

v2.041 2018-05-03 15:07 UTC

This package is auto-updated.

Last update: 2024-09-22 18:52:31 UTC


README

这是对收割机的大规模重构。本项目的重点是优化收割机,以避免不必要的查询,并允许可队列处理的操作。

Composer 设置

    "require": {
        "imamuseum/harvester2": ""
    },

服务提供商

config/app.php 中,将以下内容添加到自动加载的服务提供者中 -

Imamuseum\Harvester2\HarvesterServiceProvider::class,

将 ExampleHarvester 添加到 app/Providers/AppServiceProvider.php 以实现 HarvesterInterface。

    public function register()
    {
        $this->app->bind('Imamuseum\Harvester2\Contracts\HarvesterInterface',
            'Imamuseum\Harvester2\ExampleHarvester');
    }

现在您可以发布此包 -

php artisan vendor:publish

将项目从队列中推离:Harvester 2 将删除作业推送到名为 "high" 的队列,并将更新作业推送到默认队列。这使用户能够定义高优先级和低优先级队列,以确保在更新作业之前运行删除作业。

php artisan queue:listen
php artisan queue:listen --queue=high,low - prioritize "high" queue then "low" queue (or "default" or whatever you name your other queues)

Harvester2 具有灵活性与任何队列和任何文档存储库一起工作。目前,ElasticSearch 是唯一已实现的文档存储库。我个人建议使用 Redis 作为队列,因为它与 Laravel 合作得很好。如果您打算使用 sqlite 作为队列,请确保使用与任何源(如果您的源中包含 sqlite 数据库)分离的实例。并发性的缺乏可能导致作业失败。

Artisan 命令

php artisan create-index --index=optional - Re-Creates document Store indices according to config. Option to specify which index.
php artisan delete-index --index=optional - Deletes document Store indices according to config. Option to specify which index.
php artisan harvest --source=optional --id=null --recent=false - Runs sync. Option to specify source, id, and whether to pull all or most recently changed data

在任何命令后使用 --help 标志以查看带描述的可用选项。

支持的源

  • Piction
  • Proficio
  • 通用 API 源
  • 通用查询源

支持的文档存储库

  • ElasticSearch 5.0

许可证

Laravel 框架是开源软件,根据 MIT 许可证 授权。