
| Article details | |
|---|---|
| Author | Ben Bajek, Principal Forward Deployed Engineer |
| Published / updated | 30 November 2026 |
| Customer | Insurance, under 1,000 employees, United States |
| Platform and tools | Amazon MSK, AWS Lambda, and Snowflake; MSK pipeline trigger adapter |
| Reading time | 4 min |
Starting one Maia pipeline run per Kafka message on Amazon MSK was solved by extending Maia's queue trigger adapter, an AWS Lambda function, to read MSK topics. In our load test, 300 messages sent in 2 seconds all started a pipeline run, with none lost and none started twice. The guide was published 11 days after approval.
Why couldn't Maia start a pipeline for each Kafka message?
A US insurance company moving off an older ETL tool had Amazon Managed Streaming for Apache Kafka (Amazon MSK) topics carrying a few thousand event messages a day. It needed a pipeline run as each one landed, not on a schedule. Maia's Kafka component reads topics in batches and isn't a streaming loader.
Maia's queue trigger adapter already started one run per message for Amazon SQS, Azure Service Bus, and Azure Queue Storage, but not for Kafka.
Why did it matter?
Without a Kafka trigger, the insurer's event pipelines couldn't run once per message. A lost or doubled message would mean a missing or repeated run.
What did we build?
- Added an MSK path to the adapter's AWS Lambda function, fed by one SASL/SCRAM-authenticated event source mapping per topic.
- Added topic routes that map each topic to a Maia project, environment, pipeline, and the variable that receives the message.
- Passed the raw message base64-encoded, with
kafkaTopic,kafkaPartition, andkafkaOffset, so the pipeline can skip a message delivered twice. - Added a failure topic on the same cluster for any message that can't start a run.
- Packaged the setup as a Terraform module.
We chose a trigger over ingestion because this customer needed a run per message.
Batch size defaults to 1, because Lambda redelivers a failed batch from its lowest failed offset. A message that can never succeed (malformed JSON, oversized, or unrouted without the expected envelope) is retried, then sent to the failure topic. One that might succeed later (a 429, a 5xx, or an authentication error) holds its partition while it's retried, so runs stay in offset order, and goes to the failure topic if retries run out.
What was the result?
| Measure | Before | After | Timeframe |
|---|---|---|---|
| Burst of 300 messages in 2 seconds | Not possible | 300 runs, 0 lost, 0 twice; median 8.0 s, 95th percentile 13.9 s | 16 November 2026 |
| 53 messages over 13.5 minutes | Not possible | 53 runs, 0 lost, 0 twice; median 2.1 s, 95th percentile 32.1 s | 16 November 2026 |
| Malformed message on a partition in use | Not possible | Tried 3 times, then failure topic; the valid message behind it ran once | On our test cluster |
We load tested on our own SCRAM-authenticated MSK test cluster (2 brokers, Kafka 3.9) with the build before topic routing, a print-only pipeline, 3 partitions per topic (we assumed the partition count), batch size 1, and 3 retries. Latency runs from the message being produced to the Maia public API accepting the run. Maia showed exactly 353 runs, each matching a logged run ID.
The steady phase's slow tail was 2 HTTP timeouts and 2 cold starts, each run once on retry. Topic routing, tested later against a real MSK cluster and Snowflake, loaded 5 of 5 sample payloads and skipped a replayed message.
When does this apply to you?
This applies to teams replacing a custom Kafka consumer or a cron job that polls a topic. The guide covers setup with the Terraform module and the 1.3.0-arm64 or later image. The adapter signs in with SASL/SCRAM, which we also added to the Kafka component in an earlier Field Note.
The adapter is the wrong choice when you need data in the warehouse within seconds: at our burst's 95th percentile, the trigger alone took 13.9 seconds. Each message is also a pipeline run that uses credits: 10,000 messages a day is 10,000 runs.
- Partitions set concurrency: at most one Lambda invocation per partition.
- Topic routes need 1.3.0 or later: 1.2.0 sends every routed record to the failure topic.
- Payloads are capped at about 7,500 bytes, base64-encoded in a 10,000-character variable.
- Alarms cover the failure topic. A run that starts and then fails isn't retried and raises no alarm.
Frequently Asked Questions
Yes, on Amazon MSK: the MSK pipeline trigger adapter runs as an AWS Lambda function in your account and starts one pipeline run per message through the Maia public API.
No, the adapter triggers a pipeline and doesn't ingest the topic. For event data in your warehouse within seconds, use Snowflake's Kafka connector with Snowpipe Streaming.
The Lambda event source mapping retries the message, then writes it with its original content to a failure topic on the same cluster. Later messages on that partition keep running.
SASL/SCRAM, with the credentials in AWS Secrets Manager. MSK IAM authentication isn't supported.
Featuring
Our latest resources
Data management



