Deriving Tenant from Inbound Messages
Deriving the tenant header from external messages that do not carry tenant metadata
The Problem
The Solution
final class OrderEventConsumer
{
#[KafkaConsumer('orders', topics: ['orders_eu', 'orders_us'])]
#[WithTenantResolver(expression: "headers['kafka_topic']")]
public function handle(string $payload, #[Headers] array $headers): void
{
// headers['tenant'] is now populated from the originating Kafka topic
}
}Where It Can Be Placed
Scheduled Pollers
Looking Up Tenant Through External Mapping
Explicit Tenant Header Wins
Null Result
Non-Scalar Result
Last updated
Was this helpful?