
AWS EventBridge and Lambda Integrations 🚀
Here is the story, imagine you request to system and then the system integrated with another service. As a user, you want to get response as soon as possible. But the another service may take more time to process your request. This story would be interpreted as image.

Some user doesn't care with the process behind the scene because some process may be need more time to process. At least user get notification the message is being processed. 😎 it's cool.
To achieve this goal, I use AWS EventBridge to manage message. This is like eventbus or producer/consumer model if you ever heard about. For more complex system we also can include AWS API Gateway for input data to sender function. But for now I make it simple.
Note: for this tutorial, the example is in Indonesia. But it's not reduce the essentials of this tutorial. BONUS! I will teach you some Bahasa Indonesia 😁
Now let's rock! 🤘
Here is the flow:
- Create sender function but here I name it as pengirim. So pengirim is sender in English.
- Create receiver function. Receiver = penerima.
- Create EventBridge rule.
pengirim.js

Please take a note that source is "adaSalam", this is important for EventBridge to detect who is the source. in Entries you'll find the Detail. So Detail is the main content that we need to send.
penerima.js

As you can see here, I also add function to setTimeout(). So I threat it as process time. So simple.
Create rule in EventBridge

Create rule first.

adaSalam is rules that I was create. You can create rule via hit Create rule button.

As image shown above, the event pattern is like that. And the Target is penerima.
That's it from development side 👌
Now we need to test it.
{
"nama": "samaranBoleh?",
"salam": "kirim2 salam aja .. semangatt",
"tambahan": "gak ada sih paling itu aja"
}
- nama = name
- salam = message
- tambahan = additional
And then after the test, we need to check about the log. We can find the log time.

Log from pengirim

Log from penerima
As we can see here, there is time difference in both log, and it's around 10s. So we did it, yeaay!
That's it. Keep exploring and rocking 🚀🤘
Thank you all.