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.
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
Go to Computing Console > Plugins.
Find your plugin, select the version, and open the Batching configuration tab.
Create the batching configuration.
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
Implementation
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_updateroute,forces the
/segment_updateresponse type to beBatchedUserSegmentUpdatePluginResponse<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_updatereturns a single formatted line, and makes no partner call./batch_updatereceives batches no larger thanbatch_flush_max_size.Records with different grouping keys never arrive in the same batch.
The partner accepts the batched payload.
Related pages
Last updated
Was this helpful?