【问题标题】:is there a way to configure spring cloud aws with aws clientconfiguration information when connecting through proxy通过代理连接时有没有办法用aws客户端配置信息配置spring cloud aws
【发布时间】:2015-05-22 02:40:30
【问题描述】:

有没有办法在通过代理连接的com.amazonaws.ClientConfiguration 上设置可选代理详细信息, 我正在与spring-cloud-aws-version 1.0.0.RELEASE、spring-boot-version 1.2.2.RELEASE 在spring-cloud-aws-autoconfigure 一起开发。我希望能够如下配置代理详细信息

setProxyHost(java.lang.String proxyHost)
setProxyPassword(java.lang.String proxyPassword)
setProxyPort(int proxyPort)
setProxyUsername(java.lang.String proxyUsername)

cloud.aws.credentials.accessKey 和 cloud.aws.credentials.secretKey 设置在 application.properties

【问题讨论】:

    标签: java spring amazon-web-services spring-boot spring-cloud


    【解决方案1】:

    GitHub issue 回答了这个问题。

    总结:目前无法指定自定义客户端配置。相反,必须配置和提供自定义客户端。这可以通过 java config 以及 XML 来完成:

    @Bean
    public SimpleMessageListenerContainerFactory simpleMessageListenerContainerFactory() {
        SimpleMessageListenerContainerFactory factory = new SimpleMessageListenerContainerFactory();        
        factory.setAmazonSqs(customAmazonClient);
    
        return factory;
    }
    
    @Bean
    public QueueMessageHandlerFactory queueMessageHandlerFactory() {
        QueueMessageHandlerFactory factory = new QueueMessageHandlerFactory();
        factory.setAmazonSqs(customAmazonClient);
    
        return factory;
    } 
    

    或 XML:

    <aws-messaging:annotation-driven-queue-listener amazon-sqs="customAmazonClient" send-to-message-template="messageTemplateThatUsers CustomAmazonClient" />
    

    【讨论】:

    • 谢谢,这有助于将 deleteMessageOnException 属性设置为 false,以便在出现异常时不会删除消息,但不是重新驱动策略。
    猜你喜欢
    • 2021-10-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-24
    相关资源
    最近更新 更多