Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DynamoDB: flow with pagination #1985

Merged
merged 4 commits into from
Oct 17, 2019
Merged

DynamoDB: flow with pagination #1985

merged 4 commits into from
Oct 17, 2019

Conversation

ennru
Copy link
Member

@ennru ennru commented Oct 14, 2019

Purpose

Offer the paginating DynamoDB operations as a flow.

Background Context

When @julianhowarth pointed out in #767 (comment) I discovered that the GetBatchItem operation wasn't prepared for use with pagination in Alpakka.
While at it I added a flowPaginated for use of paginated results in flows to complement the source and added some documentation for flowWithContext.

(The use of a RetryFlow is still pending, we might want to remove the Try from the Java API.)

Copy link
Member

@seglo seglo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Pair<PutItemResponse, SomeContext> response =
streamCompletion.toCompletableFuture().get(1, TimeUnit.SECONDS);
fail("expected missing schema");
} catch (ExecutionException expected) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use an assertThrows here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From which library? JUnit 4 nor Hamcrest have it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like it's part of the Test attribute in JUnit 4.

@Test(expected = IndexOutOfBoundsException.class) 
public void empty() { 
     new ArrayList<Object>().get(0); 
}

https://github.com/junit-team/junit4/wiki/exception-testing

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right, haven't used that for a while.

try {
List<ScanResponse> strings = streamCompletion2.toCompletableFuture().get(1, TimeUnit.SECONDS);
fail("expected missing schema");
} catch (ExecutionException expected) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assertThrows?

### Flow with context

The `flowWithContext` allows to send an arbitrary value, such as commit handles for JMS or Kafka, past the DynamoDb operation.
The responses are wrapped in a @scaladoc[Try](scala.util.Try)] to differentiate between successful operations and errors in-stream.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo with a trailing ] on the scaladoc link.

@ennru ennru merged commit dc2ffcc into akka:master Oct 17, 2019
@ennru ennru deleted the dynamodb-pagination branch October 17, 2019 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants