-
Notifications
You must be signed in to change notification settings - Fork 13
Fix #25 by providing an Akka Stream Source graph stage for Kinesis. #39
Fix #25 by providing an Akka Stream Source graph stage for Kinesis. #39
Conversation
Thanks @aquamatthias ! Was the Producer Spec failing locally or in CI? That one relies on the initialized localstack image for the setup. |
@markglh locally. I just started with |
Yeh that should be it really, if you bash into the container ( These should exist: If not, I've seen this before where the localstack container has been cached so it doesn't initialise, in that case try deleting the cached container (no need to delete the image). |
I'll also update that test to use your method of creating what it needs as part of the test. |
Hey @markglh. This is what I see in my local docker setup, after starting
This seems to be the problem with the failing test. It failed before I did any change. Something you can look into?
|
That's weird with the travis build failing! Locally, did you try clearing the containers?
To elaborate: this version of localstack uses the healthcheck to init the container. However it seems that if the container already exists (default localstack) that it's considered healthy and doesn't run the custom healthcheck. It's not an issue in CI because it's always clean. |
Done as suggested. I get some strange logs:
but I see the streams locally:
Reenabled the test, which runs green now. Next step: try to see if we can make Travis happy. |
@markglh The sbt side of things is green as far as I can see:
But the build is not successful:
Something you can look into? |
Thanks @aquamatthias - Some progress at least :D I will look into the Travis weirdness! |
@aquamatthias I've applied the changes and refactored the integration test setup and producer spec to all create the streams on the fly. I'll have a proper run through the Stream The branch lives here: https://github.com/WW-Digital/reactive-kinesis/tree/feature/akka-streams-review - feel free to just rebase that into yours. Any concerns let me know. I'm not sure whether my tweaks affected anything - but I have seen that same test fail again in Travis. I'll also look into it. Haven't managed to reproduce locally yet. |
1 similar comment
@markglh I cherry picked your commits on top of this branch - thanks for the improvements. |
* The KinesisEvent is passed through the stream. | ||
* Every event has to be committed explicitly. | ||
*/ | ||
sealed trait KinesisEvent { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about the name of this. What about CommittableEvent
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes CommittableEvent sounds good to me. Changed it that way.
In my current project we need a way to read and handle the message and than in a later stage commit this event. In order to support such cases I changed the definition to CommittableEvent[T]
where T is emitted as ConsumerEvent
. Together with map
and mapAsync
it is possible to change the payload and still have the event context. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just the one minor code change mentioned above.
Otherwise, would you mind adding a new section to the readme here:
https://github.com/WW-Digital/reactive-kinesis/blame/master/README.md#L298
With a h3 heading Akka Stream Source Implementation
- which gives a short overview of the implementation with a code example like the other sections in the readme.
Then add another heading here:
https://github.com/WW-Digital/reactive-kinesis/blame/master/README.md#L208
Actor Based Implementation
- to separate out the two implementations.
I'm trying to keep the library as approachable as possible by having detailed docs for newcomers.
After that we're all good! Thanks again for all your work :D
I would ideally like a unit test for KinesisSourceGraph
- but it's not trivial and we have it covered in the integration test - so I'm happy to defer that.
…Kinesis. This graph stage provides an akka source graph based on the actor model provided by the reactive kinesis consumer.
A sealed trait with a private implementation makes it hard to test.
…use a different implementation in tests. Add a KinesisSourceGraphSpec.
6ed6fa1
to
460651a
Compare
1 similar comment
@markglh Thanks for good review comments. |
4bf9b84
to
357efd3
Compare
That's great @aquamatthias - the changes make sense too, thanks again for this!! |
Initial PR #36 has been closed in favour of automated integration testing setup.
This graph stage provides an akka source graph based on the actor model provided by the reactive kinesis consumer.
If a consumer is configured, an akka stream Source can be obtained via a simple Kinesis.source("consumer-name").
Every message that flows through the stream needs to be committed explicitly.
An integration test is added that relies on localstack running on the same node (I did not add the localstack startup logic as part of this PR).
Steps to run the test:
Set this env var, since the localstack does not support CBOR: export AWS_CBOR_DISABLE=true
Start localstack (I use the docker-compose with: docker-compose -f localstack.yml up) in default configuration (Kinesis on port 4568, Dynamo on port 4569)
sbt it:test
It was not as easy to come up with a good integration test, since a Kinesis Source usually never finishes. To have a finite test, I use Flow.take which ends the stream after a defined amount of entries. The interplay of different readers/shard consumers could be different between runs, but the test expectation should be met.
@markglh tests and integration tests have passed several successive test runs on my machine.
Let me know what you think.