Skip to main content
Custom Pull Strategy provides a customized approach for retrieving lists of created, updated, or deleted records. This strategy consists of two methods: subscribe and pull.

How It Works

  1. When a subscription is created, a state is generated and stored. It allows pulling events starting from the subscription time.
  2. When events are pulled, the state is used to generate events since the state was created, as well as the new state for the next pull.

Configuration Example

Functions

subscribe

File: <event-type>-subscribe.<ext>, for example created-subscribe.js The subscribe method initializes the subscription to events and retrieves a unique identifier for future pulls. Arguments:
  • parameters – object, parameters (matching parametersSchema) of this particular data collection.
Result:
  • state – object, subscription state. This state will be saved and passed as state to the pull function.
Example:

pull

File: <event-type>-pull.<ext>, for example created-pull.js The pull method fetches records based on the subscription and stores them in the state.
It also generates events for each created, updated, or deleted record.
Arguments:
  • state – object, state returned from subscribe function.
  • parameters – object, parameters (matching parametersSchema) of this particular data collection.
Result:
  • events – list of objects representing events with type and record fields.
  • state – updated state information, including the new information for subsequent pulls.
Example: