Class: SpreeCmCommissioner::Integrations::PollingJob
- Inherits:
-
BaseJob
- Object
- ActiveJob::Base
- ApplicationJob
- ApplicationJob
- BaseJob
- SpreeCmCommissioner::Integrations::PollingJob
- Defined in:
- app/jobs/spree_cm_commissioner/integrations/polling_job.rb
Overview
Job that performs the actual polling (syncing) for a specific integration
This job is enqueued by PollingSchedulerJob and handles:
-
Full syncs: Complete refresh of all data
-
Incremental syncs: Fetch only recent changes
-
Webhook syncs: Real-time event processing (triggered externally)
Each integration type (StadiumXV1, LarrytaV1, etc.) must implement a sync_manager that responds to sync_full!, sync_incremental!, and sync_webhook!
Instance Method Summary collapse
-
#perform(options) ⇒ Object
Perform the integration pull.
Methods included from ApplicationJobDecorator
handle_deserialization_error, prepended
Instance Method Details
#perform(options) ⇒ Object
Perform the integration pull
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/jobs/spree_cm_commissioner/integrations/polling_job.rb', line 18 def perform() integration_id = [:integration_id] sync_type = [:sync_type] event_type = [:event_type] event_data = [:event_data] integration = SpreeCmCommissioner::Integration.find(integration_id) # integration is no longer active, skip processing. return unless integration.active? SpreeCmCommissioner::Integrations::Polling.new.call( integration: integration, sync_type: sync_type, event_type: event_type, event_data: event_data ) rescue StandardError => e handle_sync_error(e, ) raise end |