Retrieving and logging S3 bucket file contents
The example shows how to access files stored in an Amazon S3 bucket, read their contents, and log the output for further processing or debugging.
Before you begin
- Check whether you have the developer and admin roles assigned from the page.
- Obtain the credentials to log in to Amazon S3 back end account.
- In webMethods Integration, create an Amazon S3 account, for example, AmazonSimpleStorageServiceS3_1.
- Amazon S3 Bucket name to retrieve the files.
Procedure
- Select the project where you want to create the new flow service. You can also create a new project.
- Click the Flow services tab and click the Plus icon.
- Provide a name, for example, AmazonS3, and an optional description for the new flow service.
- Type Amazon Simple Storage Service (S3) in the search box, select it, and then select the action or operation, getBucket.
- Select the AmazonSimpleStorageServiceS3_1 account. You can also create or configure an account inline.
- Click the Mapping icon to set a value for getbucketinput.
- Expand getBucketInput and click bucketName.
- Type softwareagbucketaws as the value for bucketName.
- Click the Add icon to add a new step. Then type repeat to select the Repeat step and select the content option.
- Select Amazon Simple Storage Service (S3) and choose the getObject action to retrieve the object from the specified bucket.
- Click the Mapping icon to map the input and output fields.
- Click the pipeline input fields (name and key) and drag it to the service input (bucketName and objectName). The service output (getObjectOutput) is automatically mapped to the pipeline output by a dotted line.
- Click the Add icon to add a new step as shown below.
- Select the flow function and then select the logCustomMessage service. You can also type logCustomMessage and select it. This logs a message, which you can view in the flow service execution results screen.
- Map the input (stream) to message. This step logs the contents of the files in the bucket.
- Save the flow service and click Run.
What to do next
You can view the execution result in the page. Click the execution result name link to view the execution details.