Summary: Reference for the pfx-s3 Camel component -- AWS S3 bucket operations using IM-managed connections.
Overview
The pfx-s3 component wraps the Apache Camel AWS2-S3 component and adds Integration Manager connection support. Instead of configuring AWS credentials and bucket details inline, you reference a named S3 connection defined in IM.
The component is registered under the scheme pfx-s3 and belongs to the CLOUD category.
URI Format
pfx-s3:connectionName[?options]
The connectionName path parameter is required and references an S3 connection configured in Integration Manager.
Connection Configuration
An S3 connection in IM provides:
|
Field |
Description |
|---|---|
|
|
AWS region of the S3 bucket (e.g., |
|
|
Name of the S3 bucket |
|
|
AWS access key ID |
|
|
AWS secret access key (encrypted at rest) |
Example Connection JSON
{
"id": "myS3",
"type": "s3",
"region": "eu-central-1",
"bucket": "my-integration-bucket",
"accessKey": "AKIAIOSFODNN7EXAMPLE",
"secretKey": "ENC(encrypted-value)"
}
Endpoint Parameters
Since pfx-s3 extends the Camel AWS2-S3 component, all AWS2-S3 endpoint parameters are available. The most commonly used ones:
Producer Parameters (Writing to S3)
|
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
String |
|
The object key name (file path in the bucket) |
|
|
String |
|
Operation to perform: |
|
|
boolean |
|
Delete the local file after uploading |
Consumer Parameters (Reading from S3)
|
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
String |
|
Filter objects by key prefix |
|
|
String |
|
Delimiter for grouping object keys |
|
|
int |
|
Maximum objects to retrieve per poll |
|
|
boolean |
|
Delete the object from S3 after reading |
|
|
boolean |
|
Move object to a different bucket/key after reading |
|
|
String |
|
Destination bucket for move-after-read |
|
|
String |
|
Key prefix in the destination bucket |
|
|
boolean |
|
Include the object body in the exchange |
Usage Examples
Read CSV files from S3 and import to Pricefx
<routes xmlns="http://camel.apache.org/schema/spring">
<route id="s3Import">
<from uri="pfx-s3:myS3?prefix=inbound/products/&deleteAfterRead=true"/>
<to uri="pfx-csv:unmarshal"/>
<to uri="pfx-api:loaddata?objectType=P&mapper=productMapper"/>
</route>
</routes>
Export data to S3
<routes xmlns="http://camel.apache.org/schema/spring">
<route id="s3Export">
<from uri="timer://export?repeatCount=1"/>
<to uri="pfx-api:fetch?objectType=P&filter=allProducts"/>
<to uri="pfx-csv:marshal"/>
<setHeader name="CamelAwsS3Key">
<simple>exports/products-${date:now:yyyyMMdd}.csv</simple>
</setHeader>
<to uri="pfx-s3:myS3"/>
</route>
</routes>
List objects in a bucket
<route id="s3List">
<from uri="direct:listFiles"/>
<to uri="pfx-s3:myS3?operation=listObjects&prefix=inbound/"/>
<log message="Found objects: ${body}"/>
</route>
Poll S3 and archive processed files
<route id="s3PollAndArchive">
<from uri="pfx-s3:myS3?prefix=inbox/&moveAfterRead=true&destinationBucket=my-archive-bucket&destinationBucketPrefix=processed/"/>
<to uri="pfx-csv:unmarshal"/>
<to uri="pfx-api:loaddata?objectType=PX&mapper=pxMapper"/>
</route>
Error Handling
-
If the connection name is missing or empty, an
IllegalArgumentExceptionis thrown at route startup. -
If the named S3 connection is not found in the IM registry, a
NonRecoverableExceptionis thrown. -
If
useDefaultCredentialsProviderisfalseand neither an S3 client nor access/secret keys are provided, anIllegalArgumentExceptionis thrown. -
AWS SDK errors (access denied, bucket not found, etc.) propagate as standard Camel exceptions and can be handled with
onExceptionordoTry/doCatch.
See Also
-
Connections -- managing connections in Integration Manager
-
Routes -- route configuration
-
S3 Integration Pattern -- complete S3 integration patterns