Workflow synchronization
Workflow synchronization is the heart of Zuora Workflow Manager. This process downloads workflows from the Zuora API and saves them to the local database for visualization and management.How it works
Synchronization flow
Pagination
Synchronization automatically handles pagination:- Page size: 50 workflows per page (configurable)
- Auto-pagination: Continues until last page
- Progress tracking: Monitors progress via Moox Jobs
Synchronization modes
1. Manual synchronization (UI)
From the Customers list:- Click the Sync Workflows icon in the Actions column
- The job is queued immediately
- Monitor progress in Jobs → Jobs Waiting
- After creating a new customer
- When updated data is needed immediately
- To test Zuora connection
| Method | Trigger | Monitoring |
|---|---|---|
| UI Button | Manual click on customer | Jobs → Jobs Waiting |
2. Automatic synchronization (Scheduler)
The scheduler automatically executes synchronization:3. CLI synchronization
Synchronize from terminal:- During deployment
- For troubleshooting
- For immediate sync without queue
| Option | Parameter | Description |
|---|---|---|
| All customers | --all | Synchronize all customers |
| Specific customer | --customer="Name" | Synchronize a specific customer by name |
| Synchronous mode | --sync | Run sync immediately without queue |
Detailed process
Step 1: Credential validation
Before starting, the system validates:Step 2: OAuth 2.0 authentication
Step 3: Fetch workflows
Step 4: Download JSON export
For each workflow:Step 5: Database save
Step 6: Task extraction
Step 7: Cleanup obsolete workflows
Error handling
Retry logic
Jobs have automatic retry:| Attempt | Expected after | Total elapsed |
|---|---|---|
| 1 | Immediate | 0 seconds |
| 2 | 60 seconds | 60 seconds |
| 3 | 120 seconds | 180 seconds |
Handled errors
Authentication errors:- Invalid credentials → Job terminated (no retry)
- Token expired → Regenerate token automatically
- Timeout → Automatic retry
- Connection refused → Automatic retry
- Rate limiting → Retry with backoff
- Invalid JSON → Log warning, continue with other workflows
- Missing required fields → Log warning, skip workflow
Error monitoring
Failed Jobs:- Navigate to Jobs → Failed Jobs
- View detailed error
- Click Retry to re-execute
Performance
Implemented optimizations
Caching:- OAuth tokens cached (1 hour)
- Reduces authentication calls
- 50 workflows per page
- Avoids timeout on large datasets
- Asynchronous jobs
- Does not block UI
- Parallel processing possible
- Indexes on zuora_id, customer_id
- Foreign keys for integrity
- Cascade delete for cleanup
Typical metrics
Synchronization time:| Workflows | Estimated time | API calls |
|---|---|---|
| 10 | ~5-10 seconds | 1-3 pages |
| 50 | ~20-30 seconds | 1-5 pages |
| 100 | ~40-60 seconds | 1-10 pages |
| Factor | Impact |
|---|---|
| Zuora network latency | High |
| Workflow JSON size | Medium |
| Number of tasks per workflow | Medium |
| Database load | Low-Medium |
Best practices
Synchronization frequency
Development:- Manual when necessary
- Scheduler every hour for testing
- Scheduler every hour (default)
- Every 30 minutes for critical data
- Manual for immediate updates
Monitoring
Check regularly:- Failed jobs (retry or investigate)
- Sync duration (performance issues?)
- Error logs (error patterns?)
- Email on failed jobs (configurable)
- Slack notifications (via Laravel)
- Monitoring tools (Sentry, Bugsnag)
Troubleshooting
Workflows not synchronized:- Verify customer credentials
- Check queue worker is active
- Verify failed jobs
- Check logs for errors
- Verify Zuora network latency
- Check database load
- Increase workers if necessary
- Consider additional cache
- Verify complete JSON export
- Check logs for warnings
- Verify Zuora API permissions
- Manual test with Postman