software.amazon.awssdk.services.kinesis.model.SubscribeToShardResponse Java Examples
The following examples show how to use
software.amazon.awssdk.services.kinesis.model.SubscribeToShardResponse.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SubscribeToShardIntegrationTest.java From aws-sdk-java-v2 with Apache License 2.0 | 5 votes |
private void verifyHttpMetadata(SubscribeToShardResponse response) { SdkHttpResponse sdkHttpResponse = response.sdkHttpResponse(); assertThat(sdkHttpResponse).isNotNull(); assertThat(sdkHttpResponse.isSuccessful()).isTrue(); assertThat(sdkHttpResponse.headers()).isNotEmpty(); assertThat(response.responseMetadata()).isNotNull(); assertThat(response.responseMetadata().extendedRequestId()).isNotEqualTo("UNKNOWN"); assertThat(response.responseMetadata().requestId()).isNotEqualTo("UNKNOWN"); }
Example #2
Source File: KinesisStreamEx.java From aws-doc-sdk-examples with Apache License 2.0 | 5 votes |
/** * Creates a SubscribeToShardResponseHandler the classic way by implementing the interface */ // snippet-start:[kinesis.java2.stream_example.custom_handler] private static CompletableFuture<Void> responseHandlerBuilderClassic(KinesisAsyncClient client, SubscribeToShardRequest request) { SubscribeToShardResponseHandler responseHandler = new SubscribeToShardResponseHandler() { @Override public void responseReceived(SubscribeToShardResponse response) { System.out.println("Receieved initial response"); } @Override public void onEventStream(SdkPublisher<SubscribeToShardEventStream> publisher) { publisher // Filter to only SubscribeToShardEvents .filter(SubscribeToShardEvent.class) // Flat map into a publisher of just records .flatMapIterable(SubscribeToShardEvent::records) // Limit to 1000 total records .limit(1000) // Batch records into lists of 25 .buffer(25) // Print out each record batch .subscribe(batch -> System.out.println("Record Batch - " + batch)); } @Override public void complete() { System.out.println("All records stream successfully"); } @Override public void exceptionOccurred(Throwable throwable) { System.err.println("Error during stream - " + throwable.getMessage()); } }; return client.subscribeToShard(request, responseHandler); }
Example #3
Source File: FanOutRecordsPublisher.java From amazon-kinesis-client with Apache License 2.0 | 5 votes |
@Override public void responseReceived(SubscribeToShardResponse response) { log.debug("{}: [SubscriptionLifetime]: (RecordFlow#responseReceived) @ {} id: {} -- Response received. Request id - {}", parent.shardId, connectionStartedAt, subscribeToShardId, response.responseMetadata().requestId()); final RequestDetails requestDetails = new RequestDetails(response.responseMetadata().requestId(), connectionStartedAt.toString()); parent.setLastSuccessfulRequestDetails(requestDetails); }