All language subtitles for 033-Emitting Events-git.ir

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

We've now got an initial implementation of our event plus but together we're not going to start to go

through our Postal Service and our common service.

Anytime something interesting happens inside those services such as creating a new post or creating

a new comment we're gonna make sure that we send a request over to this events and point in our event

bus and in that request we're going to include the event event plus we'll then take that event and echo

it out to all the different services running inside of our application at present are different services

do not have this post events and point wired up.

So when the event bus tries to send that request over the request is going to fail due to a for a for

as soon as we make sure that the event bus can emit this event will then go back over and start to implement

these end points that the other services can listen to these events that are being emitted.

But again right now we're just gonna make sure that the Postal Service is going to meet this event anytime

someone creates a new post so let's get to it.

Between the last video and this one I opened up my code editor inside of my roots blog project directory.

We're going to start to have to change between all for these different services very quickly and so

it's just a lot easier to maneuver between them if we have all of our projects open inside of one editor

as opposed to four separate editors.

I'm going to find the post directory inside there I'll find the next dot J File at the very top.

I'll immediately require an axis like so and then going to scroll down to our post end point.

So this is the code that gets executed every single time someone tries to create new post.

So this would be a perfect time to try to emit an event saying hey someone just made a new post right

after we add the new post to our post collection.

I'll use axioms to make a post request over to age TTP.

Colin flash flash local host in four thousand five.

Because remember that is where a broker is running flash events

and then as the second argument we'll put in the actual event that we want to send over.

So for right now we'll say that every event that we met is going to have two properties.

The first one is going to be a type and that type describes that event that just occurred the second

property will be a data property and that will have some information that further clarifies exactly

what happened in the case of creating a post we'll probably include the actual post that was just created

as the data property.

Remember that event that we send out throughout our application can have any structure we want.

It doesn't have to be an object it can be a string or a number.

Any data you want to have.

But usually we're going to make sure that all these events have a very consistent structure.

We'll talk more about the design and sort of schema of events quite a bit over time.

Right now we're just gonna say that every event will have a type.

And data gets us the object right here is essentially the event that I want to have emitted or my entire

application going to give it a type of post created and then a data and data is going to be the post

that we just made.

I remember all of our posts have an I.D. and title.

That's essentially what our post is.

So we pretty much want to take that style of object right there included as the data property.

We'll say I.D. and title then finally this is an asynchronous operation making the network request.

So we will add on async and await like so that I'm going to say this we're gonna flip back over to our

browser and find our running react application.

I'm going to refresh this page and as soon as I do you'll notice that all the posts go away.

That is totally fine it's because remember all of our posts are being stored in memory with that post

service.

So as soon as we restart that server all of our posts just disappear.

All right I'll go ahead and try to create a post we'll call this new post and submit it.

We don't have any kind of live reload on the react application so I have to refresh the page as soon

as I do so I do see the new post appear.

What happened to that event.

Well let's go take a look at our terminal.

We'll take a look at our server logs.

We'll just make sure that the postal service did try to send that event over to the event plus that.

So here are my terminal logs right here.

This second window that I have right here.

That's kind of highlighted is the postal service.

I don't see any information there that's very interesting.

If I go down to the bottom window right here that is where might event broker or event plus is living

or actually running at present.

It looks like there was a couple of errors here so all these errors are identical in nature.

They'll say request failed with status for 0 4.

So that is actually good.

Remember as I mentioned just a moment ago our post service comment service and query service that doesn't

exist did it exist yet does not have this post slash events end point.

You don't have any way of actually receiving these events.

So even though the event bus is trying to send that event off.

Well there's nothing receive it which is why we're getting that forum for error.

So overall I'd say this looks good.

We are definitely emitting an event to the event bus anytime something interesting happens inside the

post service.

Let's take a pause right here and continue in just a moment.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.