{"id":25519676,"url":"https://github.com/aligent/oro-async-bundle","last_synced_at":"2025-04-11T00:32:56.124Z","repository":{"id":36288510,"uuid":"223084630","full_name":"aligent/oro-async-bundle","owner":"aligent","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-28T01:02:11.000Z","size":95,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":27,"default_branch":"master","last_synced_at":"2025-04-02T23:46:11.737Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aligent.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-21T03:59:54.000Z","updated_at":"2024-11-06T00:19:16.000Z","dependencies_parsed_at":"2024-11-06T01:21:21.447Z","dependency_job_id":"dc015d20-d0f3-4191-aac3-5cd727a97223","html_url":"https://github.com/aligent/oro-async-bundle","commit_stats":{"total_commits":14,"total_committers":3,"mean_commits":4.666666666666667,"dds":0.5,"last_synced_commit":"756360b68b2339f81dcf78ef9dddace8fafbbf7f"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aligent%2Foro-async-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aligent%2Foro-async-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aligent%2Foro-async-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aligent%2Foro-async-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aligent","download_url":"https://codeload.github.com/aligent/oro-async-bundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248322770,"owners_count":21084336,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-19T17:29:20.948Z","updated_at":"2025-04-11T00:32:56.096Z","avatar_url":"https://github.com/aligent.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Aligent Async Events Bundle\n---\nThis bundle provides:\n\n1. An Abstract Processor class that will catch RetryableExceptions and after 3 (default) retries place\nthe failed jobs into the database so they can be reviewed, fixed and then requeued.\n   \n2. Webhook integration\n\nInstallation Instructions\n-------------------------\n1. Install this module via Composer\n\n        composer require aligent/async-bundle\n\n1. Clear cache\n\n        php bin/console cache:clear\n\n1. Run Migrations\n\n        php bin/console oro:migration:load --force\n\nUsage\n-------\nMake sure your class extends the AbstractRetryableProcessor and perform your normal job processing in the execute function.\n\n```\nclass TestJobProcessor extends AbstractRetryableProcessor\n{\n    /**\n     * @param MessageInterface $message\n     * @return string\n     * @throws RetryableException\n     */\n    public function execute(MessageInterface $message)\n    {\n        $body = JSON::decode($message-\u003egetBody());\n        \n        try {\n            // Process the job here\n            $this-\u003eimportSomeEntities($body);\n        } catch (\\Exception $e) {\n            throw new RetryableException(\n                'This job failed and needs a retry',\n                0,\n                $e\n            );\n        }\n    }\n}\n```\n\nBy default the AbstractRetryableProcessor will fetch the passed exception from the RetryableException and store the trace.\nHowever if you aren't catching an exception you can just use the RetryableException and it will store the trace and message generated at this point.\n\n```\nclass TestJobProcessor extends AbstractRetryableProcessor\n{\n    /**\n     * @param MessageInterface $message\n     * @return string\n     * @throws RetryableException\n     */\n    public function execute(MessageInterface $message)\n    {\n        $body = JSON::decode($message-\u003egetBody());\n        \n        // Process the job here\n        $success = $this-\u003eimportSomeEntities($body);\n        \n        if (!$success) {\n            throw new RetryableException('This job failed and needs a retry');\n        }\n    }\n}\n```\n\nYou can also increase or decrease the amount of retries by overriding `const MAX_RETRIES = 3;` in your own class.\n\nSet up Transport for Webhooks\n-----------\nGo to the \"System -\u003e Integrations -\u003e Manage integrations\" and click \"Create Integration\". Select \"Webhook\" as the integration type and fill all required fields.\n\nTo Enable set status as Active.\n\n![Webhook Integration Form](Resources/doc/images/webhook-integration.png?raw=true \"Webhook Integration Form\")\n\nOnce complete you must now receive webhook events to requested URL.\n\nDispatch webhook events\n-----------\n\n1. EntityEventListener listens to any create/update/delete events;\n   check if relevant webhook transport exists and active;\n   if yes, pushes message to the queue\n\n```\nAligent\\AsyncEventsBundle\\EventListener\\EntityEventListener:\nlazy: true\narguments:\n- '@Aligent\\AsyncEventsBundle\\Provider\\WebhookConfigProvider'\n- '@oro_message_queue.client.message_producer'\n- '@logger'\ntags:\n- { name: doctrine.event_listener, event: onFlush }\n- { name: doctrine.event_listener, event: postFlush }\n```\n\n2. WebhookEntityProcessor builds a payload and send a webhook event in response to the queued message.\n\n```\nAligent\\AsyncEventsBundle\\Async\\WebhookEntityProcessor:\nparent: Aligent\\AsyncEventsBundle\\Async\\AbstractRetryableProcessor\ncalls:\n- [setConfigProvider, ['@Aligent\\AsyncEventsBundle\\Provider\\WebhookConfigProvider']]\n- [setTransport, ['@Aligent\\AsyncEventsBundle\\Integration\\WebhookTransport']]\n- [setSerializer, ['@oro_importexport.serializer']]\ntags:\n- { name: 'oro_message_queue.client.message_processor' }\n```\n\n3. If you need to enrich payload data (ex., add addreses for the customer user),\n you can use OroImportExportBundle and add some custom normalizers to add/transform payload data.\n\nSupport\n-------\nIf you have any issues with this bundle, please create a [GitHub issue](https://github.com/aligent/oro-async-bundle/issues).\n\nContribution\n------------\nAny contribution is highly appreciated. The best way to contribute code is to open a [pull request on GitHub](https://help.github.com/articles/using-pull-requests).\n\nDeveloper\n---------\nAdam Hall \u003cadam.hall@aligent.com.au\u003e\n\nLicence\n-------\n[MIT](https://opensource.org/licenses/mit)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faligent%2Foro-async-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faligent%2Foro-async-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faligent%2Foro-async-bundle/lists"}