Skip to main content

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:

  1. Query for pending work items of type EXTERNAL
  2. Process the work externally
  3. 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​

PropertyValue
Keyshop.unchained.worker-plugin.external
TypeEXTERNAL
Externaltrue
Sourceworker/external