承接 itx/importer 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

itx/importer

Composer 安装命令:

composer require itx/importer

包简介

A TYPO3 extension which contains a failure safe framework for building structured import processes.

关键字:

README 文档

README

This TYPO3 extension provides a failure tolerant structured import system for TYPO3 CMS. It provides a framework to create import jobs which, can be run in parallel. For every import there is a job queue that will be created by a producer class and consumed by a consumer class. The extension also provides a backend module to view and manage the imports, its jobs, statistics and potential failures.

Usage

Running the queue worker

To run the queue worker for the importer extension, run the following command:

vendor/bin/typo3cms importer:queue-worker

This will run a single queue worker process. You can run multiple queue workers in parallel to speed up the import.

To have them run automatically in multiple instances, you can use the following command:

vendor/bin/typo3cms importer:queue-worker-manager <optional worker count>

Importing data

To create a new import, you need to create 3 files:

  1. Producer class

    The producer class should inherit from the Itx\Importer\Command\Producer\AbstractJobProducer class. Inside the producer class you make the api calls to get information about the data you want to import. Finally, you will need to use the generateJobs method to create the jobs that will be processed by the queue worker.

  2. Payload class

    Use a custom payload class to pass typesafe data to the consumer class. This class doesn't getters and setters.

  3. Consumer class

    The consumer class will be called by the queue worker and needs to implement the ConsumerInterface. It will receive the payload class as a parameter. Inside the consumer class you can use the data from the payload class to import the data into your database. You don't need to register the consumer, it will be automatically detected.

When all jobs were processed the importer will call the finish method on the producer class. Use this method to clean up temporary files or to delete old records.

You will need to register the producer class as a command in a Service.yaml. The naming will be as follows

    importer:producer:<importer type name here>

Make sure to use the same name as for the producer class importer type name method.

Note: If you use the importer extension in another extension you will need to add the following configuration to your extension's Services.yaml (just below _defaults):

_instanceof:
    Itx\Importer\Consumer\ConsumerInterface:
        tags: [ 'queue_consumer' ]
        lazy: true
    Itx\Importer\Command\Producer\AbstractJobProducer:
        tags: [ 'queue_producer' ]
        lazy: true

That's it! You can now set up as many queue workers as you want as well as configure a scheduler task for the producer and the import will be executed automatically.

Race conditions and locking

Because every job could be run in parallel by the runtime, there is a chance that the same records might be tried to be imported multiple times. To prevent that from happening, you can use the Itx\Importer\Service\LockingService::createLock() method. This method returns a Lock object, on which you can call the acquire() method. Make sure to call it with the blocking=true argument. Also make sure to call the release() method on the lock object when you are done with it. The lock is autoconfigured to be released when the process ends, but it's good practice to release it manually.

Child jobs

You can create jobs that are discovered while a job is being processed. This is useful if you have to import hierarchical data.

Statistics

To create statistics for your import, you can use the Itx\Importer\Service\StatisticsService::addStatistic() method. The method can run in parallel and will automatically aggregate the statistics for you. To have data in different places make sure to use the same table name and record name for the same data. The values will be added together, when called multiple times.

You can see the resulting statistics records in the backend module.

Cleanup

There is a cleanup command that can be used to delete previous imports and their data.

vendor/bin/typo3cms importer:cleanup <keep number of imports>

itx/importer 适用场景与选型建议

itx/importer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.25k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 08 月 16 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「TYPO3 CMS」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 itx/importer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 itx/importer 我们能提供哪些服务?
定制开发 / 二次开发

基于 itx/importer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.25k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 17
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2024-08-16