简体   繁体   中英

is there a way to configure spring cloud aws with aws clientconfiguration information when connecting through proxy

Is there a way to Set optional proxy details on com.amazonaws.ClientConfiguration connecting through a proxy, am developing with spring-cloud-aws-version 1.0.0.RELEASE , spring-boot-version 1.2.2.RELEASE in spring-cloud-aws-autoconfigure . I want to be able to configure proxy details as follows

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

cloud.aws.credentials.accessKey and cloud.aws.credentials.secretKey is set in a application.properties

This question was answered in a GitHub issue .

Summary: there is currently no way to specify a custom client configuration. Instead a custom client must be configured and provided. This can be done with java config as well as with 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;
} 

Or XML:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM