Created
January 29, 2022 01:48
-
-
Save wenqiglantz/147d0f77f448ce636dd66b4d4094b740 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AmazonEventBridge client = AmazonEventBridgeClient.builder() | |
.withRegion(Regions.US_EAST_1) | |
.withCredentials(new DefaultAWSCredentialsProviderChain()) | |
.build(); | |
PutEventsRequestEntry requestEntry = new PutEventsRequestEntry(); | |
requestEntry.withSource("customer-service") //this needs to match the event pattern defined in step 4 below | |
.withDetailType("customer-created-detail-type") //this needs to match the event pattern defined in step 4 below | |
.withDetail(toJson(customerWasCreated)) //this converts the event object into JSON string | |
.withEventBusName("test-event-bus"); //this needs to match the custom event bus name created in step 4 below | |
PutEventsRequest request = new PutEventsRequest(); | |
request.withEntries(requestEntry); | |
PutEventsResult result = client.putEvents(request); //AmazonEventBridgeClient puts the event onto the event bus |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment