Configuring Connection Details

For the direction and binder name of this Micro-Integration, see Micro-Integration for Amazon S3 .

This section provides instructions for configuring the connection details required to establish communication between the Micro-Integration and your third-party system.

For information about configuring the connection to the event broker, see Step 1: Connecting to Your Event Broker .

For information about configuring error handling, see Step 5: Error Handling.

We recommend starting from the application.yml file provided in the samples/config directory of your downloaded archive, and updating it with the connection details described in this section, rather than building a configuration file from scratch. For more information, see Deploying Your Self-Managed Micro-Integration .

To share settings across all workflows in a Micro-Integration, configure the binder-specific parameters under default at the binder level instead of under a workflow-specific identifier (for example, input-0) in bindings. This reduces repetition when multiple workflows use the same parameter values. Workflow-specific settings override default settings when both are present.

Note that default is a sibling of bindings; it is not nested under bindings. Use the same hierarchy under default as you use under bindings.<binding-name>. For example, for bindings.input-0.consumer.someProperty=someValue the default setting is default.consumer.someProperty=someValue.

spring:
  cloud:
    stream:
      <binder-name>:
        default:
          consumer:
            <shared parameters>
        bindings:
          input-0:
            consumer:
              <workflow-specific parameters>

Prerequisites

Before you use the Micro-Integration for Amazon S3, ensure that the following prerequisites are met:

  • A valid AWS account with an S3 bucket. If you configure Amazon S3 as a target and set autoCreateBucket to true, the bucket is created automatically if it does not already exist.

  • An AWS Identity and Access Management (IAM) access key ID and secret access key with the permissions required for the direction you configure:

    • As a source: s3:GetObject and s3:ListBucket on the bucket you configure.

    • As a target: s3:PutObject on the bucket you configure, and s3:CreateBucket if autoCreateBucket is enabled.

  • The AWS Region in which the bucket is located.

Amazon S3 Connection Details

To configure the Amazon S3 connection details, set the following values in the application.yml file:

spring:
  cloud:
    stream:
      bindings:
        input-1:
          destination: "aws2-s3://bucketNameOrARN"
          binder: awss3

The Spring Cloud Stream standard properties for the Amazon S3 are as follows.

Configuration Option Type Valid Values Description

spring.cloud.stream.bindings.input-<workflow-id>.destination

String

A valid Amazon S3 bucket name or Amazon Resource Name (ARN)

The Amazon S3 destination to read from, in the format: 

aws2-s3://bucketNameOrARN

spring.cloud.stream.bindings.input-<workflow-id>.binder

String

awss3

This property must be set to awss3.

Parameters for Amazon S3 as a Source

To configure Amazon S3 as a source, set the properties described in the sections that follow.

Checkpoint Store Configuration

The Micro-Integration for Amazon S3 stores the current progress of file processing in a checkpoint store backed by a Last Value Queue (LVQ) on a Solace event broker.

The following table lists the configuration options for the checkpoint store.

Configuration Option Type Valid Values Default Value Description

camel-binder.checkpoint.lvqName

String

Any

None

Required.

The name of the LVQ (spool size 0) to be used for checkpointing. The queue must exist on the same event broker and Message VPN as the target queue.

If the LVQ is deleted (administratively) or a message from the LVQ is deleted or consumed by another consumer, the Micro-Integration will not be able to resume from the last checkpoint. In addition, the LVQ should not be shared by multiple instances of the Micro-Integration.

camel-binder.checkpoint.autoProvisionLvq

boolean

(true | false)

false

Optional.

Set to true to auto-provision the LVQ if it does not exist.

Amazon S3 Consumer Binding Configuration Options

The following configuration options are available for the Amazon S3 consumer binding. These properties are configured under spring.cloud.stream.awss3.bindings.input-<workflow-id>.consumer.endpoint.query-parameters. For example:

spring:
  cloud:
    stream:
      awss3:
        bindings:
          input-<workflow-id>:
            consumer:
              endpoint:
                query-parameters:
                  accessKey: ${AWS_ACCESS_KEY:}
                  secretKey: ${AWS_SECRET_KEY:}
                  region: ${AWS_REGION:us-east-1}
Property Type Valid Values Default Value Description

destination

String

A valid AWS S3 bucket name or ARN

-

Required. The Amazon S3 consumer destination. Specifies the bucket name or ARN. For example, aws2-s3://bucketNameOrARN.

accessKey

String

A valid AWS access key ID

None

Required. The AWS access key ID.

secretKey

String

A valid AWS secret access key

${AWS_SECRET_KEY:}

Optional. The AWS secret access key.

region

String

A valid AWS region (for example, us-east-1)

None

Required. The AWS region.

deleteAfterRead

Boolean

true, false

false

When true, the Micro-Integration consumes and deletes the file, regardless of whether it has been read before.

When false:

  • If a file has already been consumed, the Micro-Integration periodically downloads it again but ignores it.

  • The time it takes to cycle through the entire folder increases as more files are added.

  • If the Micro-Integration is shut down while a file is pending, it may hang for a short time.

  • Renaming a file causes it to be consumed again.

The deleteAfterRead property is also configurable as a workflow default by specifying: 

spring.cloud.stream.awss3.default.consumer.endpoint.query-parameters.deleteAfterRead.

prefix

String

A valid S3 object key prefix

-

Optional. A prefix to filter objects in the bucket. Only objects with keys starting with this prefix are consumed. If not set, all objects in the bucket are processed. For example, if prefix is inbound/, only objects in the inbound/ folder are processed.

fileType

String

json, xml, delimited

None

Optional. The file type that determines how the connector parses the content of the consumed files. For details about configuring these file types, see one of:

JSON File Type Configuration Options

When fileType is set to json, the following configuration options are available.

Property Type Valid Values Default Value Description

jsonPath

String

A valid JSONPath expression

$

A JSONPath expression used to split the JSON file into multiple messages. The default is $, which means the entire file is treated as a single message. For example, if a JSON file contains an array of objects [{"a":1}, {"a":2}], setting jsonPath to $.* generates two separate messages.

XML File Type Configuration Options

When fileType is set to xml, the following configuration options are available:

Property Type Valid Values Default Value Description

xPath

String

A valid XPath expression

/

An XPath expression that splits the XML file into multiple messages. Default is /, which means the entire file is treated as a single message. For example, if an XML file is <root><item>1</item><item>2</item></root>, setting xPath to /root/item generates two messages.

Delimited File Type Configuration Options

When fileType is set to delimited, the following configuration options are available:

Property Type Valid Values Default Value Description

eventDelimiter

String

Any character or string

\n

The character or string that separates records in a delimited file.

paramDelimiter

String

Any character or string

,

The character or string that separates fields within each record.

Advanced Consumer Configuration Options

The following additional options are available to control the behavior of the Micro-Integration for Amazon S3. These properties are configured under spring.cloud.stream.awss3.bindings.input-<workflow-id>.consumer.endpoint.query-parameters.

Option Type Default Description

autoCreateBucket

boolean

false

When true, enables the autocreation of the S3 bucket. You can also use this parameter when the moveAfterRead option is enabled to create the destinationBucket if it doesn't already exist.

delimiter

String

None

The delimiter to use to consume only objects you are interested in.

forcePathStyle

boolean

false

When true, the S3 client uses a path-style URL instead of virtual-hosted-style.

overrideEndpoint

boolean

false

When true, enables overriding the endpoint. This option must be used in combination with the uriEndpointOverride option.

policy

String

None

The policy for this queue to set in the com.amazonaws.services.s3.AmazonS3#setBucketPolicy() method.

uriEndpointOverride

String

None

The overriding URI endpoint. This option must be used in combination with the overrideEndpoint option.

customerAlgorithm

String

None

The customer algorithm to use when CustomerKey is enabled.

customerKeyId

String

None

The id of the Customer key to use when CustomerKey is enabled.

customerKeyMD5

String

None

The MD5 of Customer key to use when CustomerKey is enabled.

destinationBucket

String

None

The destination bucket where an object must be moved when moveAfterRead is set to true.

destinationBucketPrefix

String

None

The destination bucket prefix to use when an object must be moved, and moveAfterRead is set to true.

destinationBucketSuffix

String

None

The destination bucket suffix to use when an object must be moved, and moveAfterRead is set to true.

doneFileName

String

None

If provided, Camel consumes files only if a done file exists.

fileName

String

None

The file name to get the object from the bucket.

maxConnections

int

60

The maxConnections parameter in the S3 client configuration.

maxMessagesPerPoll

int

10

The maximum number of messages as a limit to poll at each polling. The default value is 10. Use 0 or a negative number to set it as unlimited.

moveAfterRead

boolean

false

When true, moves objects from S3 bucket to a different bucket after they have been retrieved. To accomplish the operation, the destinationBucket option must be set. The copy bucket operation is only performed if the Exchange is committed. If a rollback occurs, the object is not moved.

removePrefixOnMove

boolean

false

When true, removes the prefix from the object key when moving it to the destination bucket.

batchMessageNumber

int

10

The number of messages composing a batch in streaming upload mode.

batchSize

int

1000000

The batch size (in bytes) in streaming upload mode.

bufferSize

int

1000000

The buffer size (in bytes) in streaming upload mode.

deleteAfterWrite

boolean

false

When true, deletes the file object after the S3 file has been uploaded.

keyName

String

None

The key name for an element in the bucket through endpoint parameter.

streamingUploadMode

boolean

false

When true, the upload to bucket is done in streaming.

streamingUploadTimeout

long

None

When streaming upload mode is true, this option sets the timeout to complete upload.

awsKMSKeyId

String

None

The id of KMS key to use when KMS is enabled.

conditionalWritesEnabled

boolean

false

When true, uploads the object only if the object key name does not already exist in the bucket specified.

useAwsKMS

boolean

false

When true, KMS must be used.

useCustomerKey

boolean

false

When true, Customer Key must be used.

useSSES3

boolean

false

When true, SSE S3 must be used.

proxyHost

String

None

The proxy host when instantiating the SQS client.

proxyPort

Integer

None

A proxy port to be used inside the client definition.

proxyProtocol

Protocol

HTTPS

The proxy protocol to use instantiating the S3 client. Set to one of:

  • HTTP

  • HTTPS

backoffErrorThreshold

int

None

The number of subsequent error polls that must occur before the backoffMultiplier is triggered. Error polls are polls that fail because of an error.

backoffIdleThreshold

int

None

The number of subsequent idle polls that must occur before the backoffMultiplier is triggered.

backoffMultiplier

int

None

A multiplier that allows the scheduled polling consumer to back off if there has been a number of subsequent idle polls or errors in a row. The multiplier represents the number of polls that are skipped before the next actual attempt occurs. When you use this option, you must also configure backoffIdleThreshold and/or backoffErrorThreshold.

delay

long

500

The number of milliseconds before the next poll.

greedy

boolean

false

When true, the ScheduledPollConsumer runs immediately again if the previous run polled one or more messages.

initialDelay

long

1000

The number of milliseconds before the first poll starts.

repeatCount

long

0

The maximum number of times the scheduler fires. For example, if you set this parameter to 1, the scheduler fires only once. If you set it to 5, the scheduler fires five times. A value of zero or a negative value means the scheduler fires indefinitely.

startScheduler

boolean

true

When true, the scheduler is auto started.

useFixedDelay

boolean

true

When true, fixed delay is used. When false, fixed rate is used. See ScheduledExecutorService in the JDK for details.

profileCredentialsName

String

None

The profile name when using a profile credentials provider.

sessionToken

String

None

The Amazon AWS Session Token used when the user must assume an IAM role.

trustAllCertificates

boolean

false

When true, all certificates are trusted when overriding the endpoint.

useDefaultCredentialsProvider

boolean

false

When true, the S3 client expects to load credentials through a default credentials provider.

useProfileCredentialsProvider

boolean

false

When true, the S3 client expects to load credentials through a profile credentials provider.

useSessionCredentials

boolean

false

When true, the S3 client expects to use Session Credentials (useful when the user must assume an IAM role for doing operations in S3).

Parameters for Amazon S3 as a Target

To configure Amazon S3 as a target, set the properties described in the sections that follow.

Amazon S3 Producer Binding Configuration Options

The following configuration options are available for the Amazon S3 producer binding. These properties are configured under spring.cloud.stream.awss3.bindings.output-<workflow-id>.producer.endpoint.query-parameters. For example:

spring:
  cloud:
    stream:
      bindings:
        output-<workflow-id>:
          destination: "aws2-s3://my-bucket"
          binder: awss3
      awss3:
        bindings:
          output-<workflow-id>:
            producer:
              endpoint:
                query-parameters:
                  region: ${AWS_REGION:us-east-1}
                  accessKey: ${AWS_ACCESS_KEY:}
                  secretKey: ${AWS_SECRET_KEY:}
Config Option Type Valid Values Default Value Description

destination

String

A valid AWS S3 URI

-

Required. The URI of the AWS S3 bucket where files are stored. Format: aws2-s3://<bucketNameOrARN>.

region

String

A valid AWS region (for example, us-east-1)

-

Required. The AWS region.

accessKey

String

A valid AWS access key ID

-

Required. The AWS access key ID for authenticating with AWS.

secretKey

String

A valid AWS secret access key, in the format RAW(<your-secret-access-key>)

-

Optional. The AWS secret access key associated with accessKey.

autoCreateBucket

Boolean

true, false

false

Optional. When true, the target bucket is created automatically if it does not already exist.

maxRecords

Integer

1-1000000

10000

Optional. The maximum number of records aggregated into a single file before it is flushed to the bucket.

timeoutMs

Integer

1-600000

60000

Optional. The maximum time, in milliseconds, to wait before flushing an incomplete aggregation to the bucket.

fileFormat

String

JSONL, XML, PARQUET, CSV

JSONL

Optional. The output file format used when writing records to the target bucket. For details about configuring each format, see one of:

additionalProperties

Map<String,String>

Key-value pairs

-

Optional. Additional producer endpoint query parameters, specified as key-value pairs. For the list of supported parameters, see Additional Producer Properties.

JSONL File Format Options

When fileFormat is set to JSONL, the following configuration options are available.

Config Option Type Default Value Description

expressionTemplate

String

${uuid}.jsonl

Optional. The template used to build the target file name. Supports simple expressions, for example ${uuid}.jsonl.

XML File Format Options

When fileFormat is set to XML, the following configuration options are available.

Config Option Type Default Value Description

expressionTemplate

String

${uuid}.xml

Optional. The template used to build the target file name. Supports simple expressions, for example ${uuid}.xml.

xmlRootTag

String

root

Optional. The XML root element tag name that wraps all events in the batch.

prependToFile

String

-

Optional. A string to prepend to the beginning of each output file, for example an XML declaration. This is applied only once, when the file is created.

Parquet File Format Options

When fileFormat is set to PARQUET, the following configuration options are available.

Config Option Type Valid Values Default Value Description

expressionTemplate

String

-

${uuid}.parquet

Optional. The template used to build the target file name. Supports simple expressions, for example ${uuid}.parquet.

maxSizeBytes

Integer

1-524288000

52428800

Optional. The maximum aggregated size, in bytes, before a file is flushed.

avroSchemaFile

File

A valid .avsc file

-

Optional. The Avro schema file used when writing Parquet output. If you do not set this option, the Micro-Integration writes each message unmodified as a string in a data field, with a timestamp field set to the time the message was processed, in epoch milliseconds. The payload must be valid JSON.

CSV File Format Options

When fileFormat is set to CSV, the following configuration options are available.

Config Option Type Default Value Description

expressionTemplate

String

${uuid}.csv

Optional. The template used to build the target file name. Supports simple expressions, for example ${uuid}.csv.

containsHeaders

Boolean

false

Optional. When true, incoming CSV messages carry their own header as the first line, which is stripped before merging with other messages.

prependToFile

String

-

Optional. A string to prepend to the beginning of each output file, for example a header line. This is applied only once, when the file is created.

Additional Producer Properties

The following additionalProperties options are available for the Amazon S3 producer.

Config Option Type Valid Values Default Value Description

keyName

String

-

-

Optional. The key name to use for the target object, overriding the name otherwise generated from destination.

forcePathStyle

Boolean

true, false

false

Optional. When true, the client uses path-style URLs instead of virtual-hosted-style URLs. Useful for S3-compatible storage services that don't support virtual-hosted-style addressing.

multiPartUpload

Boolean

true, false

false

Optional. When true, files are uploaded using S3 multipart upload. The part size is controlled by partSize.

partSize

Long

Minimum 5 MB (AWS requirement)

26214400 (25 MB)

Optional. The part size, in bytes, used when multiPartUpload is true.

streamingUploadMode

Boolean

true, false

false

Optional. When true, files are uploaded to the bucket in streaming mode rather than as a single buffered upload. Related options: streamingUploadTimeout, batchMessageNumber, batchSize, bufferSize.

streamingUploadTimeout

Long

-

-

Optional. The timeout, in milliseconds, to complete the upload when streamingUploadMode is true.

batchMessageNumber

Integer

-

10

Optional. The number of messages composing a batch when streamingUploadMode is true.

batchSize

Integer

-

1000000 (1 MB)

Optional. The batch size, in bytes, when streamingUploadMode is true.

bufferSize

Integer

-

1000000 (1 MB)

Optional. The buffer size, in bytes, when streamingUploadMode is true.

delimiter

String

-

-

Optional. The delimiter used to group object keys when listing objects in the bucket.

overrideEndpoint

Boolean

true, false

false

Optional. When true, enables overriding the endpoint. You must use this option together with uriEndpointOverride.

policy

String

-

-

Optional. The policy to apply to the bucket by using the com.amazonaws.services.s3.AmazonS3#setBucketPolicy() method.

prefix

String

-

-

Optional. A prefix to filter objects in the bucket.

uriEndpointOverride

String

-

-

Optional. The URI of the endpoint to use instead of the default endpoint. You must use this option together with overrideEndpoint.

customerAlgorithm

String

-

-

Optional. The encryption algorithm for the customer-provided key. Use this option when useCustomerKey is true.

customerKeyId

String

-

-

Optional. The ID of the customer-provided encryption key. Use this option when useCustomerKey is true.

customerKeyMD5

String

-

-

Optional. The MD5 hash of the customer-provided encryption key. Use this option when useCustomerKey is true.

deleteAfterWrite

Boolean

true, false

false

Optional. When true, deletes the file object after the S3 file has been uploaded.

restartingPolicy

String

override, lastPart

override

Optional. The restarting policy to use when streamingUploadMode is true. One of override or lastPart.

awsKMSKeyId

String

-

-

Optional. The ID of the AWS Key Management Service (KMS) key. Use this option when useAwsKMS is true.

conditionalWritesEnabled

Boolean

true, false

false

Optional. When true, uploads the object only if an object with the same key name does not already exist in the bucket.

useAwsKMS

Boolean

true, false

false

Optional. When true, encrypts uploaded objects with AWS KMS.

useCustomerKey

Boolean

true, false

false

Optional. When true, encrypts uploaded objects with a customer-provided key.

useSSES3

Boolean

true, false

false

Optional. When true, encrypts uploaded objects with Amazon S3-managed keys (SSE-S3).

proxyHost

String

-

-

Optional. The hostname of the proxy server that the S3 client uses.

proxyPort

Integer

-

-

Optional. The port of the proxy server that the S3 client uses.

proxyProtocol

String

HTTP, HTTPS

HTTPS

Optional. The proxy protocol to use when instantiating the S3 client. One of HTTP or HTTPS.

profileCredentialsName

String

-

-

Optional. The profile name to use when useProfileCredentialsProvider is true.

sessionToken

String

-

-

Optional. The AWS session token to use when you must assume an IAM role.

trustAllCertificates

Boolean

true, false

false

Optional. When true, the S3 client trusts all certificates when you override the endpoint.

useDefaultCredentialsProvider

Boolean

true, false

false

Optional. When true, the S3 client loads credentials through the default credentials provider.

useProfileCredentialsProvider

Boolean

true, false

false

Optional. When true, the S3 client loads credentials through a profile credentials provider.

useSessionCredentials

Boolean

true, false

false

Optional. When true, the S3 client uses session credentials. Use this option when you must assume an IAM role to perform S3 operations.

lazyStartProducer

Boolean

true, false

false

Optional. When true, the producer is not started until the first message is processed. Use this to allow the connector to start even if the producer would otherwise fail to start.

Connecting to Multiple Systems

To connect to multiple systems of the same type, use the multiple binder syntax.

For example:

spring:
  cloud:
    stream:
      binders:
      
      # 1st solace binder in this example
      solace1:
        type: solace
        environment:
          solace:
            java:
              host: tcp://localhost:55555

      # 2nd solace binder in this example
      solace2:
        type: solace
        environment:
          solace:
            java:
              host: tcp://other-host:55555

        # The only awss3 binder
        awss31:
          type: awss3
          # Add `environment` property map here if you need to customize this binder.
          # But for this example, we'll assume that defaults are used.

        # Required for internal use
        undefined:
          type: undefined
      bindings:
        input-0:
          destination: <input-destination>
          binder: awss31
        output-0:
          destination: <output-destination>
          binder: solace1 # Reference 1st solace binder
        input-1:
          destination: <input-destination>
          binder: awss31
        output-1:
          destination: <output-destination>
          binder: solace2 # Reference 2nd solace binder

The configuration above defines two binders of type solace and one binder of type awss3, which are then referenced within the bindings.

Each binder above is configured independently under spring.cloud.stream.binders.<bindername>.environment..

  • When connecting to multiple systems, all binder configuration must be specified using the multiple binder syntax for all binders. For example, under the spring.cloud.stream.binders.<binder-name>.environment.

  • Do not use single-binder configuration (for example, solace.java.* at the root of your application.yml) while using the multiple binder syntax.