Creating a source connector
Source connectors fetch data from external systems. They are resolved through
Connector and are usually used by indexers.
Responsibilities
- expose a stable connector identifier;
- read credentials from connector or indexer configuration;
- fetch records in batches;
- support cursors or date ranges where needed;
- return raw data in a format the indexer can transform;
- keep API-specific logic outside the indexer.
Identifier
public function getIdentifier(): string
{
return 'vendor.external_source';
}
Copied!
Example skeleton
final class MySourceConnector implements MySourceConnectorInterface
{
public function getIdentifier(): string
{
return 'vendor.external_source';
}
public function fetchRecords(
IndexerConfig $configuration,
int $page,
int $limit
): array {
// Fetch external records and return normalized raw data.
}
}
Copied!
Service registration
services:
Vendor\Extension\Indexing\Connector\MySourceConnector:
tags:
- name: 'aiassistant.indexing.connector'
Copied!
Design rule
Keep API-specific logic in connectors and indexing decisions in indexers. The connector fetches data; the indexer decides how source identifiers, text content and metadata are created.