For the complete documentation index, see llms.txt. This page is also available as Markdown.

Batching for feeds

Aggregate unit segment updates into batches when your partner needs batched input.

Your goal

Deliver batched data to a partner that requires it, even though the platform sends your plugin unit updates - one UserPoint at a time.

Expected outcome

A plugin whose /user_segment_update route formats one record, and whose /batch_update route receives those records aggregated into batches by the platform.

Batching is currently only available for plugins of type AUDIENCE_SEGMENT_EXTERNAL_FEED.

Why it exists

The platform provides unit updates to an external feed plugin, one UserPoint at a time, through the /user_segment_update route. Many partner APIs expect a payload containing many users. Rather than buffering in your own plugin - which would have to survive restarts and scaling across workers - you let the platform do the aggregation.

The output of a /user_segment_update call becomes an element of the /batch_update input.

Create a batching configuration

  1. Go to Computing Console > Plugins.

  2. Find your plugin, select the version, and open the Batching configuration tab.

  3. Create the batching configuration.

Field
Type
Description

plugin_version_id

String

The plugin version to batch. Required.

enable_batching

Boolean

Enables or disables batching. Required.

batch_flush_max_size

Integer

The maximum size of a batch, in number of lines. Required.

Split the plugin in two

1

The data formatting and gathering phase

Your /user_segment_update implementation. It formats one line - the record for a single UserPoint - and returns it. It does not call the partner.

2

The batch delivery phase

Your /batch_update implementation. It receives a batch of the lines returned above, and calls the partner once for the batch.

/batch_update returns status (OK, ERROR, RETRY), sent_items_in_success, sent_items_in_error, optional message and next_msg_delay_in_ms.

Implementation

You need version 0.14 or later of the Node.js Plugin SDK.

Rewrite your plugin to extend BatchedAudienceFeedConnectorBasePlugin<T>, where T is the type of one batched line. Doing so:

  • forces your plugin to implement the /batch_update route,

  • forces the /segment_update response type to be BatchedUserSegmentUpdatePluginResponse<T>.

Grouping records

The response carries a grouping_key field, for when your data has to be regrouped by a specific criterion.

For example, a partner may require only one identifier type per payload. In that case, use the identifier type as the grouping key.

The same concept appears on the file side, where ${GROUPING_KEY} can be used in a file name macro. See File destination.

Verify

  • /user_segment_update returns a single formatted line, and makes no partner call.

  • /batch_update receives batches no larger than batch_flush_max_size.

  • Records with different grouping keys never arrive in the same batch.

  • The partner accepts the batched payload.

Last updated

Was this helpful?