AmazonSqs
Amazon SQS source connector
Description
The Amazon SQS source connector reads messages from one Amazon SQS queue URL. Each message body is
deserialized by the configured format and schema, then emitted as SeaTunnel rows.
The connector uses a single reader and finishes the job after the current receive request is processed. It is suitable for bounded reads from a queue.
Each receive request asks SQS for up to 10 messages. If more messages are waiting in the queue, run another job or use a streaming-style upstream design that repeatedly starts bounded reads.
Support Those Engines
Spark
Flink
SeaTunnel Zeta
Key Features
Source Options
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| url | String | Yes | - | Full SQS queue URL to read from, for example https://sqs.us-east-1.amazonaws.com/123456789012/source_queue. |
| region | String | Yes | - | AWS region of the SQS queue, for example us-east-1. |
| schema | Config | Yes | - | Message body schema. For more details, see Schema Feature. |
| access_key_id | String | No | - | AWS access key ID. Set it together with secret_access_key to use static credentials. Leave both unset to use the AWS default credential provider chain. |
| secret_access_key | String | No | - | AWS secret access key. Set it together with access_key_id to use static credentials. |
| format | String | No | json | Message body format. Supported values are json, text, canal_json, and debezium_json. |
| field_delimiter | String | No | , | Field delimiter used when format = text. |
| delete_message | Boolean | No | false | Whether to delete a message from the queue after it is read and deserialized successfully. |
| message_group_id | String | No | - | Message group ID option kept for compatibility. It is not required for normal SQS reads. |
| debezium_record_include_schema | Boolean | No | true | Whether Debezium JSON messages include a schema. This option is used only when format = debezium_json. |
| common-options | No | - | Source plugin common parameters. For details, see Source Common Options. |
url can point to AWS SQS or to an SQS-compatible local service, for example http://sqs-host:4566/000000000000/source_queue.
Format Notes
jsonreads each message body as a JSON object that matchesschema.textsplits each message body byfield_delimiterand maps the values to fields inschemaorder.canal_jsonreads Canal JSON messages. For details, see Canal JSON.debezium_jsonreads Debezium JSON messages. For details, see Debezium JSON.delete_message = trueremoves consumed messages from SQS. Keep the defaultfalsewhen you only want to inspect or copy messages without deleting them.access_key_idandsecret_access_keyare optional, but they must be configured together when static AWS credentials are used.- The source performs one receive request, with up to 10 messages, and then finishes the bounded job.
Task Examples
Copy Messages Between Local-Compatible Queues
env {
parallelism = 1
job.mode = "BATCH"
}
source {
AmazonSqs {
url = "http://sqs-host:4566/000000000000/source_queue"
access_key_id = "1234"
secret_access_key = "abcd"
region = "us-east-1"
schema = {
fields {
name = "string"
}
}
}
}
sink {
AmazonSqs {
url = "http://sqs-host:4566/000000000000/sink_queue"
access_key_id = "1234"
secret_access_key = "abcd"
region = "us-east-1"
}
}
Read JSON Messages
env {
parallelism = 1
job.mode = "BATCH"
}
source {
AmazonSqs {
url = "https://sqs.us-east-1.amazonaws.com/123456789012/source_queue"
region = "us-east-1"
access_key_id = "AKIA..."
secret_access_key = "SECRET..."
schema = {
fields {
name = string
}
}
}
}
sink {
Console {}
}
Read Text Messages With a Custom Delimiter
source {
AmazonSqs {
url = "https://sqs.us-east-1.amazonaws.com/123456789012/source_queue"
region = "us-east-1"
format = text
field_delimiter = "#"
delete_message = true
schema = {
fields {
artist = string
album = string
release_year = int
}
}
}
}
sink {
Console {}
}
Changelog
Change Log
| Change | Commit | Version |
|---|---|---|
| [Improve][Core] Unify the aws-sdk-v2 version to 2.31.30 (#9698) | https://github.com/apache/seatunnel/commit/41c251cc8a | 2.3.12 |
| [Improve] restruct connector common options (#8634) | https://github.com/apache/seatunnel/commit/f3499a6eeb | 2.3.10 |
| [improve] amazon sqs connector update (#8602) | https://github.com/apache/seatunnel/commit/c747e02a98 | 2.3.10 |
| [Feature][Restapi] Allow metrics information to be associated to logical plan nodes (#7786) | https://github.com/apache/seatunnel/commit/6b7c53d03c | 2.3.9 |
| [Feature][Kafka] Support multi-table source read (#5992) | https://github.com/apache/seatunnel/commit/60104602d1 | 2.3.6 |
| [Improve][Common] Introduce new error define rule (#5793) | https://github.com/apache/seatunnel/commit/9d1b2582b2 | 2.3.4 |
[Improve] Remove use SeaTunnelSink::getConsumedType method and mark it as deprecated (#5755) | https://github.com/apache/seatunnel/commit/8de7408100 | 2.3.4 |
[Improve] Remove all useless prepare, getProducedType method (#5741) | https://github.com/apache/seatunnel/commit/ed94fffbb9 | 2.3.4 |
[Improve][Connector-V2] Change amazonsqs to AmazonSqs as connector identifier (#5742) | https://github.com/apache/seatunnel/commit/245705d0f7 | 2.3.4 |
| [Feature][Connector-V2] Add connector amazonsqs (#5367) | https://github.com/apache/seatunnel/commit/7f75a8eafd | 2.3.4 |