本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
對於無法直接連線至網際網路的應用程式,所有 AWS SDK 用戶端都支援使用 HTTP 或 HTTPS 代理。在一般的企業環境中,所有輸出網路流量都必須經過代理伺服器。如果您的應用程式使用 Kinesis Producer Library (KPL) 來收集資料,並使用代理伺服器將資料傳送至 AWS ,您的應用程式將需要 KPL 代理組態。KPL 是建置在 AWS Kinesis SDK 上的高階程式庫。它被分成一個原生處理程序和一個包裝函式。原生處理程序會執行處理和傳送記錄的所有作業,而包裝函式則會管理原生處理序並與其通訊。如需詳細資訊,請參閱使用 Amazon Kinesis Producer Library 實作高效且可靠的生產者
包裝函式是以 Java 撰寫的,而原生處理程序是使用 Kinesis SDK 以 C++ 撰寫的。KPL 版本 0.14.7 及更高版本現在支援 Java 包裝器中的代理組態,該包裝器可以將所有代理組態傳遞給原生處理程序。如需詳細資訊,請參閱 https://github.com/awslabs/amazon-kinesis-producer/releases/tag/v0.14.7
您可以使用以下程式碼將代理組態新增到您的 KPL 應用程式。
KinesisProducerConfiguration configuration = new KinesisProducerConfiguration();
// Next 4 lines used to configure proxy
configuration.setProxyHost("10.0.0.0"); // required
configuration.setProxyPort(3128); // default port is set to 443
configuration.setProxyUserName("username"); // no default
configuration.setProxyPassword("password"); // no default
KinesisProducer kinesisProducer = new KinesisProducer(configuration);