
pl.chilldev.commons.aws.sqs.SimpleQueueHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons-aws Show documentation
Show all versions of commons-aws Show documentation
Helper components for working with Amazon Web Services.
/**
* This file is part of the ChillDev-Commons.
*
* @license http://mit-license.org/ The MIT license
* @copyright 2017 © by Rafał Wrzeszcz - Wrzasq.pl.
*/
package pl.chilldev.commons.aws.sqs;
import java.util.function.Consumer;
import com.amazonaws.services.sqs.AmazonSQS;
import com.amazonaws.services.sqs.model.Message;
/**
* SQS queue handler that simply processes message body.
*/
public class SimpleQueueHandler extends QueueHandler
{
/**
* Initializes handler.
*
* @param sqs SQS client.
* @param queueUrl SQS queue URL.
* @param messageBodyHandler Single message consumer.
*/
public SimpleQueueHandler(AmazonSQS sqs, String queueUrl, Consumer messageBodyHandler)
{
super(sqs, queueUrl, (Message message) -> messageBodyHandler.accept(message.getBody()));
}
/**
* Initializes handler with the default SQS client.
*
*
* This is a simplified version for AWS internal services, like AWS Lambda, which relies on environment
* permissions.
*
*
* @param queueUrl SQS queue URL.
* @param messageBodyHandler Single message consumer.
*/
public SimpleQueueHandler(String queueUrl, Consumer messageBodyHandler)
{
super(queueUrl, (Message message) -> messageBodyHandler.accept(message.getBody()));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy