External Worker
A placeholder adapter for workers that are processed by external systems and interact with Unchained only via GraphQL.
Included in Base Preset
Registered automatically by registerBasePlugins() / registerAllPlugins().
Registration
import { pluginRegistry } from '@unchainedshop/core';
import { ExternalPlugin } from '@unchainedshop/plugins/worker/external';
pluginRegistry.register(ExternalPlugin);
Purpose
The External Worker serves as a placeholder for work items that are:
- Processed by systems outside of Unchained
- Updated via GraphQL mutations from external services
- Used to track the state of externally-managed background tasks
This adapter cannot process work internally - it throws an error if doWork is called directly. Instead, external systems should:
- Query for pending work items of type
EXTERNAL - Process the work externally
- Update the work status via GraphQL
Usage
Create external work:
mutation CreateExternalWork {
addWork(
type: EXTERNAL
input: { customData: "any-payload-for-external-system" }
) {
_id
status
}
}
Mark work as completed from external system:
mutation FinishExternalWork {
finishWork(
workId: "work-id"
result: { processed: true }
success: true
) {
_id
status
}
}
Adapter Details
| Property | Value |
|---|---|
| Key | shop.unchained.worker-plugin.external |
| Type | EXTERNAL |
| External | true |
| Source | worker/external |