如何使用 AWS SQSExtendedClient 库使其使用 JMSListener java 异步工作

问题描述 投票:0回答:1

我正在努力实现以下链接想要实现的目标。

使用 Spring JmsListener 的扩展客户端库的 Amazon SQS 异步侦听器

我无法使用下面的示例找到 AmazonS3Client 和 AmazonSQSAsync 类。有人到这一步了吗

@Bean
public ConnectionFactory connectionFactory(final AmazonS3Client amazonS3Client, final AmazonSQSAsync amazonSqs) {
    final ExtendedClientConfiguration extendedClientConfig = new ExtendedClientConfiguration()
            .withLargePayloadSupportEnabled(amazonS3Client, "my-bucket-name");

    final ProviderConfiguration providerConfiguration = new ProviderConfiguration();
    providerConfiguration.setNumberOfMessagesToPrefetch(10);

    final SQSConnectionFactory sqsConnectionFactory = new SQSConnectionFactory(providerConfiguration,
            new AmazonSQSExtendedClient(amazonSqs, extendedClientConfig));

    return sqsConnectionFactory
}

有人可以帮忙回答一下这个问题吗?有人遇到过类似的事情吗? 感谢帮助!

java amazon-web-services amazon-s3 amazon-sqs sqslistener
1个回答
0
投票

您所需的大部分依赖项是:

    <properties>
        <aws-java-sdk.version>1.11.300</aws-java-sdk.version>
        <amazon-sqs-java-messaging-lib.version>2.1.1</amazon-sqs-java-messaging-lib.version>
    </properties>

        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-sqs</artifactId>
            <version>${aws-java-sdk.version}</version>
        </dependency>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-s3</artifactId>
            <version>${aws-java-sdk.version}</version>
        </dependency>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>amazon-sqs-java-messaging-lib</artifactId>
            <version>${amazon-sqs-java-messaging-lib.version}</version>
        </dependency>
© www.soinside.com 2019 - 2024. All rights reserved.