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

AWS EventBridge Support #2061

Merged
merged 21 commits into from
May 26, 2020
Merged

AWS EventBridge Support #2061

merged 21 commits into from
May 26, 2020

Conversation

teroxik
Copy link
Contributor

@teroxik teroxik commented Dec 27, 2019

Pull Request Checklist

Purpose

  • based on the SNS implementation
  • adds Eventbridge Sink and Flow for publishing messages (PutEventsRequest / PutEventsRequestEntry) into the AWS EventBridge using the AWS 2.0 client

References

N/A

Changes

N/A

Background Context

N/A

@probot-autolabeler probot-autolabeler bot added the dependency-change For PRs changing the version of a dependency. label Dec 27, 2019
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.

AWS EventBridge looks like an interesting product. Thanks a lot for creating a PR! I did a first pass on the PR, but it looks like a great start.

Some general notes.

  • Consider the consequences of using mapAsyncUnordered with your concurrency setting. Is this important when using AWS EventBridge? Does the order of results ever matter?
  • More variety in the tests would be good to test error corner cases.
  • Alpakka documentation is still outstanding. We use paradox. I suggest using the SNS docs as a reference. Any worthwhile knowledge you've accumulated from using AWS EventBridge with Akka Streams should be added there. You can generate the docs locally with the sbt task docs/previewSite. I suggest opening an sbt session first and then make changes to the docs while you're in there, because there's a large startup performance penalty when calling the sbt task.

verify(eventBridgeClient, times(1)).putEvents(meq(expectedThird))
}

it should "publish multiple PublishRequest messages to multiple eventbridge topics" in {
Copy link
Member

Choose a reason for hiding this comment

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

It's not clear to me how this test is routing or asserting that messages are sent to different topics. It looks like the same impl as above.


verify(eventBridgeClient, never()).putEvents(any[PutEventsRequest]())
}

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we could add a test that simulates an error returned by the service. There are some example error responses in the docs. https://docs.aws.amazon.com/eventbridge/latest/userguide/add-events-putevents.html

@teroxik teroxik changed the title AWS EventBridge Support [WIP] AWS EventBridge Support Jan 19, 2020
@seglo
Copy link
Member

seglo commented Jan 20, 2020

@teroxik Thanks for pushing this forward. I see you've labelled it as a WIP. Ping us when you're ready.

@jmnarloch
Copy link

jmnarloch commented Feb 20, 2020

Hey, I wish to +1 this change I think it will be really cool interop feature between Akka and EventBridge. I had done pretty much same code changes: #2151. Since you are already ahed of with the work I will close the other pull request.

Some thoughts that I have (some of them have been pointed out here)

  • Similarly as SQS EventBridge supports batching up to 10 events on PutEvents API. I don't feel it's essential to have in the first go, though eventually people might want to optimize they API calls.
  • I was experimenting with string message Sinks, which allows you to create them by providing the event bus name, source and detail type for the event, though I don't grasp how much this is useful and how often people are actually using plain strings. The only advantage that I see is that it removes a bit of boilerplate code that needs to be written to instantiate the PutEventsRequest.

Also if you think I can help on anything, let me know.

I can write a blog post once the change will be available as well.

@teroxik
Copy link
Contributor Author

teroxik commented Feb 20, 2020

Hi there, I have the documentation almost ready. So will push it up this week. And we can hopefully move this forward and extend.

@jmnarloch
Copy link

@seglo any chance @teroxik PR would be reviewed?

@teroxik
Copy link
Contributor Author

teroxik commented Mar 19, 2020

I have added the documentation. Still wanted to spent a bit more time on the test cases. Could do today.

@seglo
Copy link
Member

seglo commented Mar 23, 2020

@seglo any chance @teroxik PR would be reviewed?

Yes. @teroxik are you ready for another review? Could you take a look at the build? The checks failed.

@teroxik
Copy link
Contributor Author

teroxik commented Mar 23, 2020

@seglo tomorrow if possible please. I will sort it.

@seglo
Copy link
Member

seglo commented Mar 23, 2020

Sure. There's no rush :)

@teroxik
Copy link
Contributor Author

teroxik commented Mar 23, 2020

@seglo the MiMa check is failing as it's trying to find previous version of the module, but there is not one as it's new, any advice how to bypass that check?

@teroxik
Copy link
Contributor Author

teroxik commented Mar 24, 2020

Will be looking into improving the test coverage as suggested today.

@seglo
Copy link
Member

seglo commented Mar 24, 2020

@seglo the MiMa check is failing as it's trying to find previous version of the module, but there is not one as it's new, any advice how to bypass that check?

Yes, for the new sbt project disable the MiMa plugin. Also, create a new alpakka issue to enable the MiMa plugin on this project once it's been released.

.disablePlugins(MimaPlugin)

@seglo
Copy link
Member

seglo commented Mar 24, 2020

Log the link to the new issue you create in a code comment where the sub project is defined.

build.sbt Outdated
@@ -280,6 +281,9 @@ lazy val simpleCodecs = alpakkaProject("simple-codecs", "simplecodecs")

lazy val slick = alpakkaProject("slick", "slick", Dependencies.Slick)

lazy val eventbridge =
alpakkaProject("aws-event-bridge", "aws.eventbridge", Dependencies.Eventbridge).disablePlugins(MimaPlugin)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have to remove this disablePlugins after next release in order to check the Binary Compatibiliy.

@jmnarloch
Copy link

Any chance for another pass of review?

@seglo
Copy link
Member

seglo commented Apr 17, 2020

Yes, I meant to do a review this week but I kept getting distracted with other tasks. It's on my todo for next week. Sorry for the delay.

@teroxik teroxik changed the title [WIP] AWS EventBridge Support AWS EventBridge Support Apr 21, 2020
@teroxik teroxik requested a review from seglo April 21, 2020 18:24
teroxik and others added 3 commits May 19, 2020 22:14
Doc updates from Seglo, thanks

Co-authored-by: Sean Glover <sean@seanglover.com>
@teroxik
Copy link
Contributor Author

teroxik commented May 20, 2020

@seglo if you can help me out why the @apidoc is not working, correctly I have accepted the suggested updates for the comments - and that broke the build.


[error] Messages published in a batch using @apidoc[EventBridgePublisher.flowSeq] are not published in an "all or nothing" manner. Event Bridge will process each event independently. Retries of the failed messages in the `PutEventsResponse` are not yet implemented.```

@seglo
Copy link
Member

seglo commented May 22, 2020

@teroxik Thanks. I've pushed a fix. I'll follow up on Monday with another review.

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

@seglo seglo merged commit 5f012f7 into akka:master May 26, 2020
@seglo
Copy link
Member

seglo commented May 26, 2020

Thanks a lot for this contribution @teroxik! It will be published to the akka snapshot repo next successful build of master.

@teroxik
Copy link
Contributor Author

teroxik commented May 26, 2020

Hi there, I think there is some more followup work still required but let's take it from there. Thanks for the help.

@seglo
Copy link
Member

seglo commented May 27, 2020

@teroxik Is there anything required that you think should gate the first release? We should create GitHub issues to address any outstanding work.

WDYT @jmnarloch?

@teroxik
Copy link
Contributor Author

teroxik commented Jun 3, 2020

@seglo I don't think there are any issues, mainly some additional suggestion we have discussed - in terms of testing, adding different shape for the sinks and flow API, based on how people would prefer to use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependency-change For PRs changing the version of a dependency. documentation p:aws-event-bridge p:new
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants