pfx-s3 Component

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

region

AWS region of the S3 bucket (e.g., eu-central-1, us-east-1)

bucket

Name of the S3 bucket

accessKey

AWS access key ID

secretKey

AWS secret access key (encrypted at rest)

Example Connection JSON

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

keyName

String


The object key name (file path in the bucket)

operation

String


Operation to perform: copyObject, deleteObject, listBuckets, deleteBucket, listObjects, getObject, getObjectRange

deleteAfterWrite

boolean

false

Delete the local file after uploading

Consumer Parameters (Reading from S3)

Parameter

Type

Default

Description

prefix

String


Filter objects by key prefix

delimiter

String


Delimiter for grouping object keys

maxMessagesPerPoll

int

10

Maximum objects to retrieve per poll

deleteAfterRead

boolean

true

Delete the object from S3 after reading

moveAfterRead

boolean

false

Move object to a different bucket/key after reading

destinationBucket

String


Destination bucket for move-after-read

destinationBucketPrefix

String


Key prefix in the destination bucket

includeBody

boolean

true

Include the object body in the exchange

Usage Examples

Read CSV files from S3 and import to Pricefx

XML
<routes xmlns="http://camel.apache.org/schema/spring">
    <route id="s3Import">
        <from uri="pfx-s3:myS3?prefix=inbound/products/&amp;deleteAfterRead=true"/>
        <to uri="pfx-csv:unmarshal"/>
        <to uri="pfx-api:loaddata?objectType=P&amp;mapper=productMapper"/>
    </route>
</routes>

Export data to S3

XML
<routes xmlns="http://camel.apache.org/schema/spring">
    <route id="s3Export">
        <from uri="timer://export?repeatCount=1"/>
        <to uri="pfx-api:fetch?objectType=P&amp;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

XML
<route id="s3List">
    <from uri="direct:listFiles"/>
    <to uri="pfx-s3:myS3?operation=listObjects&amp;prefix=inbound/"/>
    <log message="Found objects: ${body}"/>
</route>

Poll S3 and archive processed files

XML
<route id="s3PollAndArchive">
    <from uri="pfx-s3:myS3?prefix=inbox/&amp;moveAfterRead=true&amp;destinationBucket=my-archive-bucket&amp;destinationBucketPrefix=processed/"/>
    <to uri="pfx-csv:unmarshal"/>
    <to uri="pfx-api:loaddata?objectType=PX&amp;mapper=pxMapper"/>
</route>

Error Handling

  • If the connection name is missing or empty, an IllegalArgumentException is thrown at route startup.

  • If the named S3 connection is not found in the IM registry, a NonRecoverableException is thrown.

  • If useDefaultCredentialsProvider is false and neither an S3 client nor access/secret keys are provided, an IllegalArgumentException is thrown.

  • AWS SDK errors (access denied, bucket not found, etc.) propagate as standard Camel exceptions and can be handled with onException or doTry/doCatch.

See Also

  • Connections -- managing connections in Integration Manager

  • Routes -- route configuration

  • S3 Integration Pattern -- complete S3 integration patterns