GuidesAPI ReferenceRelease Notes
HomeLog InHome
Guides

BlazeDataSourceType.Composite - Android

Composite combines multiple independent data sources into a single, deduplicated feed. Each entry is fetched independently and in parallel, then merged in declaration order with first-occurrence-wins deduplication by item ID.

val dataSource = BlazeDataSourceType.Composite(
    dataSources = listOf(
        BlazeCompositeDataSourceEntry(
            dataSource = BlazeDataSourceType.Labels(blazeWidgetLabel = BlazeWidgetLabel.mustInclude("football")),
            config = BlazeCompositeDataSourceConfig(isMandatory = true)
        ),
        BlazeCompositeDataSourceEntry(
            dataSource = BlazeDataSourceType.Ids(ids = listOf("id1", "id2"))
        )
    )
)

BlazeCompositeDataSourceEntry

PropertyTypeDescription
dataSourceBlazeDataSourceType (required)The data source to fetch. Must be a fetchable case and may not itself be Composite — nesting is rejected at validation time.
configBlazeCompositeDataSourceConfigPer-entry options, e.g. whether this entry is mandatory. Defaults to BlazeCompositeDataSourceConfig().

BlazeCompositeDataSourceConfig

PropertyTypeDescription
isMandatoryBooleanWhen true, a fetch failure for this entry fails the entire composite. An empty success (0 items returned) is not treated as a failure. When false (default), a failure is silently skipped as long as at least one other entry succeeds.

Behavior

  • All entries are fetched in parallel.
  • Results are merged in declaration order; the first occurrence of a duplicate item ID wins.
  • If a mandatory entry fails, the entire composite fetch fails. Non-mandatory entry failures are skipped.
  • If all entries fail, the composite fetch fails regardless of the mandatory flag.
  • Read/unread ordering (when applicable) is applied to the final merged list, not per-entry.

Limitations

  • dataSources must not be empty.
  • No entry's dataSource may itself be Composite (no nesting).
  • Every entry must be a fetchable BlazeDataSourceType value. CMS-configured widgets are not a data source — they use widgetRemoteIdentifier at widget initialization, so they cannot be a composite entry. See CMS-configured widgets.

Did this page help you?