2017-05-07 118 views
0

我從某些源提取我的數據,現在想要將它提供給Kinesis Firehose傳送流。我在amazonKinesisFirehoseClient.putRecord(putRecordRequest)上得到「狀態碼:400;錯誤代碼:UnknownOperationException」。Kinesis Firehose客戶端putRecord拋出UnknownOperationException

我的代碼

while (data != null) { 
     PutRecordRequest putRecordRequest = new PutRecordRequest();  
     putRecordRequest.setDeliveryStreamName("xxxxxxxxxx"); 
     String line = data + "\n"; 
     System.out.println("Data ---------> " + line); 
     com.amazonaws.services.kinesisfirehose.model.Record recordData = createRecord(line); 
     putRecordRequest.setRecord(recordData); 
     System.out.println("Inside single row transfer 2222222222 --------------------"); 

     // Put record into the DeliveryStream 
     amazonKinesisFirehoseClient.putRecord(putRecordRequest); 
     System.out.println("Endddddd single row transfer --------------------"); 
} 

輸出

Inside single row transfer 111111111 -------------------- 

Data --------->{"name":"xxxxxxxx","id":xxx,"address":xxxxxxxx,"phoneNumber":"xxxxxxxxxx","age":xx} 

Inside single row transfer 2222222222 -------------------- 

com.amazonaws.services.kinesisfirehose.model.AmazonKinesisFirehoseException:null (Service: AmazonKinesisFirehose; Status Code: 400; Error Code: UnknownOperationException; Request ID: a084lc4-a0ed-7f9a-a14a-867sdw23wr68) 
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1588) 
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1258) 
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1030) 
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:742) 
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:716) 
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:699) 
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:667) 
at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:649) 
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:513) 
at com.amazonaws.services.kinesisfirehose.AmazonKinesisFirehoseClient.doInvoke(AmazonKinesisFirehoseClient.java:895) 
at com.amazonaws.services.kinesisfirehose.AmazonKinesisFirehoseClient.invoke(AmazonKinesisFirehoseClient.java:871) 
at com.amazonaws.services.kinesisfirehose.AmazonKinesisFirehoseClient.executePutRecord(AmazonKinesisFirehoseClient.java:640) 
at com.amazonaws.services.kinesisfirehose.AmazonKinesisFirehoseClient.putRecord(AmazonKinesisFirehoseClient.java:616) 
at com.cloudwick.capstone.project.PersonDetailsRecordProcessor.processRecord(PersonDetailsRecordProcessor.java:142) 
at com.cloudwick.capstone.project.PersonDetailsRecordProcessor.processRecords(PersonDetailsRecordProcessor.java:57) 
at com.amazonaws.services.kinesis.clientlibrary.lib.worker.V1ToV2RecordProcessorAdapter.processRecords(V1ToV2RecordProcessorAdapter.java:42) 
at com.amazonaws.services.kinesis.clientlibrary.lib.worker.ProcessTask.callProcessRecords(ProcessTask.java:215) 
at com.amazonaws.services.kinesis.clientlibrary.lib.worker.ProcessTask.call(ProcessTask.java:170) 
at com.amazonaws.services.kinesis.clientlibrary.lib.worker.MetricsCollectingTaskDecorator.call(MetricsCollectingTaskDecorator.java:49) 
at com.amazonaws.services.kinesis.clientlibrary.lib.worker.MetricsCollectingTaskDecorator.call(MetricsCollectingTaskDecorator.java:24) 
at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
at java.lang.Thread.run(Thread.java:745) 

我敢肯定我與室壁運動流水連接的所有憑據是正確的。我有我的S3和紅移在室壁運動流水以及映射)

感謝提前:)

回答

0

時,我已經配置端點使用https://kinesis.us-east-1.amazonaws.com而不是https://firehose.us-east-1.amazonaws.com我看到了這樣的錯誤。嘗試設置,看看是否有幫助。

另外,如果你在一個版本,支持它的SDK,你可以使用AmazonKinesisFirehoseClientBuilder和設定的區域字符串,以避免使用錯誤的端點:

AmazonKinesisFirehose firehoseClient = AmazonKinesisFirehoseClientBuilder 
    .standard() 
    .withRegion("us-west-2") 
    .build() 
相關問題