web stats
AWS S3 Get Javascript Reader - Mirth Community

Go Back   Mirth Community > Mirth Connect > General Discussion

Thread Tools Display Modes
Old 03-19-2019, 06:33 AM
nhunter nhunter is offline
What's HL7?
Join Date: Jan 2019
Posts: 1
nhunter is on a distinguished road
Default AWS S3 Get Javascript Reader

Hey guys, here is some quick code to retreive a file from an S3 bucket and inside of your Javascript reader. If you have any improvements feel free to share

// Set the AWS account Access Key, AWS account Secret Key
var awsCreds = new Packages.com.amazonaws.auth.BasicAWSCredentials(accessKey, secretKey);

// Set the s3client
var s3client = new Packages.com.amazonaws.services.s3.AmazonS3Client(awsCreds);

// Create s3Object
var s3Object = s3client.getObject(bucketName, keyName);

var s3ObjectInputStream = s3Object.getObjectContent();

var bReader = new BufferedReader(new InputStreamReader(s3ObjectInputStream));
var line;
var lines = bReader.lines().filter({
	test: function (x) {
		return x.length != 0

for (var i = 0; i < lines.length; i++) {
	logger.info('Text Line: ' + lines[i]);
	messages.add(new RawMessage(lines[i]));
return messages;
Reply With Quote
Old 03-28-2019, 09:33 AM
giogiannola giogiannola is offline
What's HL7?
Join Date: May 2018
Posts: 3
giogiannola is on a distinguished road

Great!! Thanks!
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -8. The time now is 02:53 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation