In this video, we are going to talk about using a lambda with other sources.
And specifically, we will look for the how a lambda works with the Amazon event, which is not that
we will develop almost an event list with Lambda Basket microservices, basically basket microservices,
publish an event in a synchronous way and this will consume by ordering queue with using the event pass
as an event bridge.
So our basket microservices will communicate with Amazon event minutes.
So that's why we should understand how a lambda can be worked with the Amazon event village.
So let's examine a documentation about this topic.
But before that, let's see.
Our big feature is you can see that we have finished the synchronous invocation and now we will focus
on the asynchronous invocation, which is basically a basket microservices, which is the lambda function.
We'll publish basket checkout event to the Amazon event page in order to decouple basket and ordering
microservices and perform asynchronous communication between basket and ordering.
Because once basket lambda function publish checkout event to the Amazon event page, this will be consumed
from the ordering microservices over the A base case.
Okay, let's focus on this asynchronous invocation.
And in this section we will develop and see how we can interact basket lambda microservices with the
Amazon event, which we publish in checkout event.
So let's examine the documentation about this topic.
If you go to this documentation, a dubious lambda developer, go ahead and come here.
Working with other services, we can see how a Lambda work, different services, very detailed explanation.
Basically a lambda integrates with other sources.
In order to invoke functions or take other actions.
In our case, we expect to publish anyone to the Amazon event page, and there are some common use cases.
If you scroll down, you can see these common use cases in here, but also if you scroll, then you
can see the list of services.
This is the listing, listing of services and you can see how services can be communicate or interact
with a lambda in here.
There are lots of services that we can interact with the lambda functions and if you scroll down you
can see event driven in locations.
Basically, our bus checkout event is event driven invocation.
You can see in this picture we can send this event to the Amazon event page.
And this is the event driven invocation from basket Lambda Micro Services to Amazon event page.
And it basically publishes an event and this is invoked ordering lambda asynchronously.
So we will communicate the event with this way.
But it comes to the sent to the Amazon event page and this will be consumed by the organic microservices.
Now we will develop the this publish message but also lambda can be pulling this event.
We choosing the lambda pulling in location type.
If you come back to our documentation, if you scroll down, you can see the another communication type,
which is the lambda polling.
We will see in the next section how Lambda can be pulling events or message from the Amazon space.
Okay.
And if you come here and see the event source mapping, right click open meetup, you can see the Lambda
event source mapping communication with different sources.
You see that Dynamo DB kinesis, aqueous and so on.
These are the stream based and batch based services that lambda pull from the event source mapping communication.
We will see these in the next section.
So in this video, I'm going to focus on the event driven invocations.
So this is important because we will use event driven invocation.
We're using the Amazon event page if you scroll up and see that.
These are the services that communicate with the ADA lambda.
So in here I'm going to find Amazon event, which you can see in here.
And also method of invocation is event and asynchronous invocation.
We will use publisher scribe pattern for implementing event driven asynchronous invocation with a lambda
and advantage for basket microservices.
And the event was so right click open liftoff.
This is what we are going to be looking for using a lambda with Amazon event advantage.
I want also called cloud watch events.
This is the legacy name and please don't be confused about that.
We will focus on the Amazon event page using with a lambda so event which basically helps you to respond
to state chains in our resources.
When our resources change state, they automatically send events into event stream.
So we tailored which we can create rules that match selected events in the stream and draw them to the
our target aid, which is lambda functions and so on.
So it invokes our function asynchronously with an event document that grabs the event from the source.
So if you scroll down, you can see the example event bridge events.
So the following example you can see in here basically shows that this is an event and that originated
from a database snapshot in Amazon relational database sources.
So this is an example event which is related with the Amazon relational database.
So you can see that the event needs to be this kind of information, virgin ID, detail type, source
account and so on.
We will see all these attributes from the previous video, but you should see the exactly the same format
in here as you can see that the important part is the ID in order to track these events with different
database resources and then other important attributes are detail type and the source, because detail
type and source indicate that which sources trigger this event and which action will be performed,
which event will be performed when this event published and raw to target system.
And also another important attribute is detail because once the event is published, detail attribute
is including the event itself.
So that means event data will be stored in here.
In our case, we will store basket out the data which including the basket and basket items in this
detail as a JSON format in order to move these data to ordering microservices.
So these are the important an example JSON object which triggered to Amazon event which when publishing
an event, this is the structure of the JSON.
So we will develop our basket microservices according to these events object because when we are developing
our basket microservices, basket microservices basically publish an event as a basket checkout event
and it should publish a message with this format which including the detail type, detail type, source
and detail and so on.
So as you can see that we have also understand how a lambda function typical to Amazon event page and
examine example event JSON object structure.
In the next video we are going to walk through the Amazon event, which we're choosing a management
console.