On March 17, join us for the next episode of Dapr in Action a weekly live show at 11:00 AM (EST) focused on What is the Jobs.
In this episode, you will understand what Jobs is, what are some of its concrete component implementations and how you can use it in your own applications.
ABSTRACT
A new weekly series about creating robust distributed applications and microservices using Dapr (Distributed Application Runtime).
Developers and software architects who are building distributed applications and/or microservices and they want to understand how Dapr can make their lives easier. I will use .NET and C#, but will try to use other languages as well (for example, Python).
📺 CSharp TV - Dev Streaming Destination http://csharp.tv
🌎 C# Corner - Community of Software and Data Developers https://www.c-sharpcorner.com
#CSharpTV #csharpcorner #Dapr #LiveShow
Show More Show Less View Video Transcript
0:02
[Music]
0:13
[Music]
0:33
this is your host Rodrigo and this is
0:36
this is your host Rodrigo and this is
0:36
this is your host Rodrigo and this is another episode of the dber in action
0:39
another episode of the dber in action
0:39
another episode of the dber in action series and have you ever wondered how to
0:42
series and have you ever wondered how to
0:42
series and have you ever wondered how to run jobs with
0:45
run jobs with
0:45
run jobs with zapper I've got you covered and we're
0:49
zapper I've got you covered and we're
0:49
zapper I've got you covered and we're GNA see that today we're gonna see the
0:51
GNA see that today we're gonna see the
0:51
GNA see that today we're gonna see the jobs API and I'm going to show you how
0:55
jobs API and I'm going to show you how
0:55
jobs API and I'm going to show you how easy it is to execute
0:58
easy it is to execute
0:58
easy it is to execute things in the future that's what jobs is
1:02
things in the future that's what jobs is
1:02
things in the future that's what jobs is all about right
1:05
all about right
1:05
all about right so um this is going to be great just let
1:09
so um this is going to be great just let
1:09
so um this is going to be great just let me see if this is connected yes this is
1:13
me see if this is connected yes this is
1:13
me see if this is connected yes this is connected and this is because I'm in my
1:18
connected and this is because I'm in my
1:18
connected and this is because I'm in my uh laptop this time I'm not in my
1:21
uh laptop this time I'm not in my
1:21
uh laptop this time I'm not in my desktop
1:22
desktop
1:22
desktop PC
1:24
PC
1:24
PC and so what are some of the scenarios
1:28
and so what are some of the scenarios
1:28
and so what are some of the scenarios that the jobs API
1:30
that the jobs API
1:30
that the jobs API solve uh just imagine if you want to
1:34
solve uh just imagine if you want to
1:34
solve uh just imagine if you want to make some
1:36
make some
1:36
make some backups daily or weekly or monthly that
1:40
backups daily or weekly or monthly that
1:40
backups daily or weekly or monthly that would be a great scenario for using the
1:42
would be a great scenario for using the
1:42
would be a great scenario for using the jobs API or maybe your boss or somebody
1:47
jobs API or maybe your boss or somebody
1:47
jobs API or maybe your boss or somebody one of your colleagues is asking you to
1:49
one of your colleagues is asking you to
1:49
one of your colleagues is asking you to create some
1:51
create some
1:51
create some reports um and you want to do that in a
1:55
reports um and you want to do that in a
1:55
reports um and you want to do that in a scheduled way so that's another example
1:59
scheduled way so that's another example
1:59
scheduled way so that's another example or maybe you want to run or execute some
2:01
or maybe you want to run or execute some
2:02
or maybe you want to run or execute some health checks in your application or
2:03
health checks in your application or
2:03
health checks in your application or your system that's another example right
2:07
your system that's another example right
2:08
your system that's another example right data synchronization across
2:10
data synchronization across
2:10
data synchronization across microservices or across
2:13
microservices or across
2:13
microservices or across applications or maybe you want to create
2:16
applications or maybe you want to create
2:16
applications or maybe you want to create some documents maybe you you want to
2:19
some documents maybe you you want to
2:19
some documents maybe you you want to process some kind of uh I don't know
2:22
process some kind of uh I don't know
2:22
process some kind of uh I don't know invoices or maybe you want to create
2:24
invoices or maybe you want to create
2:24
invoices or maybe you want to create some kind of um watermarks for your
2:28
some kind of um watermarks for your
2:28
some kind of um watermarks for your images or or I don't know it all depends
2:33
images or or I don't know it all depends
2:33
images or or I don't know it all depends right even you can even models uh I'm
2:37
right even you can even models uh I'm
2:37
right even you can even models uh I'm sorry train some models by using this um
2:41
sorry train some models by using this um
2:41
sorry train some models by using this um jobs
2:43
jobs
2:43
jobs API
2:44
API
2:44
API so um I'm going to show you that today
2:48
so um I'm going to show you that today
2:48
so um I'm going to show you that today and here are some notes that I want to
2:50
and here are some notes that I want to
2:50
and here are some notes that I want to talk about later
2:52
talk about later
2:52
talk about later today but let's Jump Right In the jobs
2:56
today but let's Jump Right In the jobs
2:56
today but let's Jump Right In the jobs API you get access to it by by using
3:00
API you get access to it by by using
3:00
API you get access to it by by using this dopper side carard right like any
3:04
this dopper side carard right like any
3:04
this dopper side carard right like any other building block in
3:06
other building block in
3:06
other building block in Dapper you need the side car and the
3:09
Dapper you need the side car and the
3:09
Dapper you need the side car and the side car is going to use the Dapper
3:14
side car is going to use the Dapper
3:14
side car is going to use the Dapper scheduler right so remember Dapper
3:16
scheduler right so remember Dapper
3:16
scheduler right so remember Dapper scheduler that's one of the services
3:19
scheduler that's one of the services
3:19
scheduler that's one of the services that is executed when we Dapper in it
3:22
that is executed when we Dapper in it
3:23
that is executed when we Dapper in it the local application I'm sorry the
3:26
the local application I'm sorry the
3:26
the local application I'm sorry the local system or your kubernetes cluster
3:30
local system or your kubernetes cluster
3:30
local system or your kubernetes cluster actually let me go to the terminal to
3:34
actually let me go to the terminal to
3:34
actually let me go to the terminal to show you the
3:37
show you the
3:37
show you the following so I'm gonna execute Docker PS
3:42
following so I'm gonna execute Docker PS
3:42
following so I'm gonna execute Docker PS right
3:44
right
3:44
right and here's the
3:46
and here's the
3:46
and here's the scheduler and this is running because of
3:49
scheduler and this is running because of
3:49
scheduler and this is running because of the fact that I initialized oper in this
3:52
the fact that I initialized oper in this
3:52
the fact that I initialized oper in this laptop speaking of which I'm using
3:55
laptop speaking of which I'm using
3:55
laptop speaking of which I'm using Dapper 15 I'm sorry 1.15
4:00
Dapper 15 I'm sorry 1.15
4:00
Dapper 15 I'm sorry 1.15 uh since that that's the latest version
4:02
uh since that that's the latest version
4:02
uh since that that's the latest version of the of the platform right so you have
4:08
of the of the platform right so you have
4:08
of the of the platform right so you have to have the scheduler the scheduler has
4:12
to have the scheduler the scheduler has
4:12
to have the scheduler the scheduler has has to run right has to be executing in
4:15
has to run right has to be executing in
4:15
has to run right has to be executing in order to uh schedule some jobs to
4:20
order to uh schedule some jobs to
4:20
order to uh schedule some jobs to it and then you use the D side card in
4:24
it and then you use the D side card in
4:24
it and then you use the D side card in your application and you send some
4:27
your application and you send some
4:27
your application and you send some metadata and then the scheduler is going
4:31
metadata and then the scheduler is going
4:31
metadata and then the scheduler is going to be
4:32
to be
4:32
to be sure that an endpoint that you specify
4:36
sure that an endpoint that you specify
4:36
sure that an endpoint that you specify is going to be called back when the
4:40
is going to be called back when the
4:40
is going to be called back when the scheduling kicks
4:42
scheduling kicks
4:42
scheduling kicks in okay so let's do this
4:47
in okay so let's do this
4:47
in okay so let's do this today so let's go here to the daer
4:52
today so let's go here to the daer
4:52
today so let's go here to the daer inaction
4:54
inaction
4:54
inaction folder and let's create 12 jobs
4:59
folder and let's create 12 jobs
4:59
folder and let's create 12 jobs and net new web
5:02
and net new web
5:02
and net new web API let's name IT jobs and let's use
5:07
API let's name IT jobs and let's use
5:07
API let's name IT jobs and let's use controllers just a regular asp.net core
5:11
controllers just a regular asp.net core
5:11
controllers just a regular asp.net core web API
5:13
web API
5:13
web API project and
5:16
project and
5:16
project and here you need to add the doer. jobs
5:21
here you need to add the doer. jobs
5:21
here you need to add the doer. jobs nuget
5:22
nuget
5:22
nuget package so you can do that by executing
5:27
package so you can do that by executing
5:27
package so you can do that by executing net at package and then doer.
5:31
net at package and then doer.
5:31
net at package and then doer. jobs and this going to be a breeze right
5:35
jobs and this going to be a breeze right
5:35
jobs and this going to be a breeze right very fast and we can type the jobs. cspr
5:42
very fast and we can type the jobs. cspr
5:42
very fast and we can type the jobs. cspr file just to be sure that the doer jobs
5:45
file just to be sure that the doer jobs
5:45
file just to be sure that the doer jobs nugget package is
5:47
nugget package is
5:47
nugget package is there
5:49
there
5:49
there so that's one thing let's do the
5:53
so that's one thing let's do the
5:53
so that's one thing let's do the build everything is working
5:56
build everything is working
5:56
build everything is working perfectly and finally let's add some
6:00
perfectly and finally let's add some
6:00
perfectly and finally let's add some let's add a new solution
6:02
let's add a new solution
6:02
let's add a new solution file and net new solution and then Net
6:07
file and net new solution and then Net
6:08
file and net new solution and then Net Solution add the current project and
6:11
Solution add the current project and
6:11
Solution add the current project and that's
6:12
that's
6:12
that's it actually that is it so jobs. sln
6:17
it actually that is it so jobs. sln
6:17
it actually that is it so jobs. sln since I want to use Microsoft Visual
6:19
since I want to use Microsoft Visual
6:20
since I want to use Microsoft Visual Studio
6:21
Studio
6:21
Studio 2022 to create some
6:24
2022 to create some
6:24
2022 to create some code so remember the jobs API
6:30
code so remember the jobs API
6:30
code so remember the jobs API in other words the jobs SDK for the jobs
6:35
in other words the jobs SDK for the jobs
6:35
in other words the jobs SDK for the jobs API
6:38
is inside the doer. jobs noet
6:43
is inside the doer. jobs noet
6:43
is inside the doer. jobs noet package now you need to add the Dapper
6:49
package now you need to add the Dapper
6:49
package now you need to add the Dapper job support to your
6:52
job support to your
6:52
job support to your application so I'm going to do that here
6:55
application so I'm going to do that here
6:55
application so I'm going to do that here uh builder doservices
6:57
uh builder doservices
6:57
uh builder doservices at dopper
7:02
Dapper it's start
7:04
Dapper it's start
7:04
Dapper it's start Dapper Dapper jobs and I don't have
7:08
Dapper Dapper jobs and I don't have
7:08
Dapper Dapper jobs and I don't have Microsoft copil enabled so using Dapper
7:13
Microsoft copil enabled so using Dapper
7:13
Microsoft copil enabled so using Dapper using Dapper do um jobs and then using
7:18
using Dapper do um jobs and then using
7:18
using Dapper do um jobs and then using Dapper do jobs.
7:20
Dapper do jobs.
7:20
Dapper do jobs. extensions since I don't remember the
7:24
extensions since I don't remember the
7:24
extensions since I don't remember the method Dapper jobs client that's the one
7:28
method Dapper jobs client that's the one
7:28
method Dapper jobs client that's the one okay
7:30
okay
7:30
okay that is inside Dapper do jobs.
7:33
that is inside Dapper do jobs.
7:33
that is inside Dapper do jobs. extensions so this method is going to
7:36
extensions so this method is going to
7:36
extensions so this method is going to enable you to inject the dber jobs
7:40
enable you to inject the dber jobs
7:40
enable you to inject the dber jobs client into your
7:44
client into your
7:44
client into your controllers so first let's rename this
7:49
controllers so first let's rename this
7:49
controllers so first let's rename this let's remove this weather forecast
7:52
let's remove this weather forecast
7:52
let's remove this weather forecast nonsense and let's remove everything
7:56
nonsense and let's remove everything
7:56
nonsense and let's remove everything let's get rid of that code and actually
8:00
let's get rid of that code and actually
8:00
let's get rid of that code and actually you know what let's remove weather
8:02
you know what let's remove weather
8:02
you know what let's remove weather forecast as
8:03
forecast as
8:03
forecast as well okay
8:06
well okay
8:06
well okay fantastic now let's use the primary
8:09
fantastic now let's use the primary
8:09
fantastic now let's use the primary Constructor syntax to inject Dapper jobs
8:13
Constructor syntax to inject Dapper jobs
8:13
Constructor syntax to inject Dapper jobs client that's the
8:15
client that's the
8:15
client that's the one this is the object that enables you
8:19
one this is the object that enables you
8:19
one this is the object that enables you to send the job to the
8:22
to send the job to the
8:22
to send the job to the scheduler make
8:24
scheduler make
8:24
scheduler make sense okay now public is in task
8:30
sense okay now public is in task
8:30
sense okay now public is in task that returns I action result and let's
8:33
that returns I action result and let's
8:33
that returns I action result and let's name it set it's going to be HTTP post
8:37
name it set it's going to be HTTP post
8:37
name it set it's going to be HTTP post just a regular endpoint and now I can go
8:43
just a regular endpoint and now I can go
8:43
just a regular endpoint and now I can go ahead
8:45
ahead
8:45
ahead and execute scheduled job
8:49
and execute scheduled job
8:49
and execute scheduled job acing right and you can set the job name
8:53
acing right and you can set the job name
8:53
acing right and you can set the job name as you can see here on the screen and
8:56
as you can see here on the screen and
8:56
as you can see here on the screen and then the scheduling configuration
9:00
then the scheduling configuration
9:00
then the scheduling configuration so for instance let's name this my job
9:04
so for instance let's name this my job
9:04
so for instance let's name this my job right it could be a good you can specify
9:09
right it could be a good you can specify
9:09
right it could be a good you can specify your own naming pattern if you like you
9:14
your own naming pattern if you like you
9:14
your own naming pattern if you like you can actually send that here as part of
9:17
can actually send that here as part of
9:17
can actually send that here as part of the payload that this endpoint is
9:20
the payload that this endpoint is
9:20
the payload that this endpoint is receiving however I'm going to set the
9:23
receiving however I'm going to set the
9:23
receiving however I'm going to set the name as my job okay cool now doer job
9:28
name as my job okay cool now doer job
9:28
name as my job okay cool now doer job schedule
9:30
schedule
9:30
schedule Dapper job schedule has those
9:35
Dapper job schedule has those
9:35
Dapper job schedule has those properties and it actually has
9:39
properties and it actually has
9:39
properties and it actually has some uh static methods for creating the
9:43
some uh static methods for creating the
9:43
some uh static methods for creating the scheduling uh
9:45
scheduling uh
9:45
scheduling uh configuration for example if you want to
9:49
configuration for example if you want to
9:49
configuration for example if you want to execute the
9:51
execute the
9:51
execute the job in a
9:54
job in a
9:54
job in a particular uh
9:55
particular uh
9:55
particular uh moment let's say that I want to execute
9:58
moment let's say that I want to execute
9:58
moment let's say that I want to execute the f
10:00
the f
10:00
the f job in one minute from now so from
10:06
job in one minute from now so from
10:06
job in one minute from now so from minutes right
10:08
minutes right
10:08
minutes right from minutes then one that could be one
10:13
from minutes then one that could be one
10:13
from minutes then one that could be one option or maybe you want to use those
10:17
option or maybe you want to use those
10:17
option or maybe you want to use those other properties maybe you want to use
10:20
other properties maybe you want to use
10:20
other properties maybe you want to use hourly for executing the job in an
10:24
hourly for executing the job in an
10:24
hourly for executing the job in an hourly fashion or weekly or daily and so
10:27
hourly fashion or weekly or daily and so
10:27
hourly fashion or weekly or daily and so on or daily right right midnight monthly
10:32
on or daily right right midnight monthly
10:32
on or daily right right midnight monthly so as you can see those are scheduling
10:34
so as you can see those are scheduling
10:34
so as you can see those are scheduling configurations that are pretty pretty
10:37
configurations that are pretty pretty
10:37
configurations that are pretty pretty helpful when you want to set the
10:41
helpful when you want to set the
10:41
helpful when you want to set the scheduling right in this case I want to
10:43
scheduling right in this case I want to
10:43
scheduling right in this case I want to use from duration since I want to do
10:48
use from duration since I want to do
10:48
use from duration since I want to do things quite easy
10:51
things quite easy
10:51
things quite easy today so I'm going to schedule the job
10:55
today so I'm going to schedule the job
10:55
today so I'm going to schedule the job in the following one minute and then
10:59
in the following one minute and then
10:59
in the following one minute and then let's see what's going on
11:01
let's see what's going on
11:02
let's see what's going on here so this is from duration that's
11:05
here so this is from duration that's
11:05
here so this is from duration that's perfect that's the daer job schedule
11:07
perfect that's the daer job schedule
11:07
perfect that's the daer job schedule object and then you need to specify that
11:10
object and then you need to specify that
11:10
object and then you need to specify that read only memory of
11:13
read only memory of
11:13
read only memory of bite in other words you need to S you
11:17
bite in other words you need to S you
11:17
bite in other words you need to S you you need to serialize your data your
11:20
you need to serialize your data your
11:20
you need to serialize your data your payload that you want to send to the
11:22
payload that you want to send to the
11:22
payload that you want to send to the scheduler
11:25
scheduler
11:25
scheduler right speaking of which let's create a
11:28
right speaking of which let's create a
11:28
right speaking of which let's create a new record record my job or something
11:32
new record record my job or something
11:32
new record record my job or something let's name it
11:34
let's name it
11:34
let's name it name my job that's the name and I want
11:37
name my job that's the name and I want
11:37
name my job that's the name and I want to have this property which is
11:39
to have this property which is
11:39
to have this property which is name and again this is this depends on
11:44
name and again this is this depends on
11:44
name and again this is this depends on your requirements right I'm just
11:46
your requirements right I'm just
11:46
your requirements right I'm just creating this record it could be a class
11:49
creating this record it could be a class
11:49
creating this record it could be a class it could be any other kind of a
11:51
it could be any other kind of a
11:51
it could be any other kind of a structure uh as far as it can be
11:55
structure uh as far as it can be
11:55
structure uh as far as it can be serialized
11:57
serialized
11:57
serialized okay um
11:59
okay um
11:59
okay um perfect now let's serialize the thing so
12:04
perfect now let's serialize the thing so
12:04
perfect now let's serialize the thing so Json serializer that comes from system.
12:08
Json serializer that comes from system.
12:08
Json serializer that comes from system. Json system. text. Json that's the names
12:12
Json system. text. Json that's the names
12:12
Json system. text. Json that's the names space and then
12:15
space and then
12:15
space and then zize right I'm gonna use this one
12:19
zize right I'm gonna use this one
12:19
zize right I'm gonna use this one zeroize to utfa bytes I don't want to
12:23
zeroize to utfa bytes I don't want to
12:23
zeroize to utfa bytes I don't want to string that's the thing right I want to
12:26
string that's the thing right I want to
12:26
string that's the thing right I want to use
12:27
use
12:27
use this um
12:31
overload that's why I need that read
12:33
overload that's why I need that read
12:33
overload that's why I need that read only memory of bite so this is going to
12:38
only memory of bite so this is going to
12:38
only memory of bite so this is going to help me zeroize to UTF 8 bytes and then
12:43
help me zeroize to UTF 8 bytes and then
12:43
help me zeroize to UTF 8 bytes and then I'm going to pass the
12:45
I'm going to pass the
12:45
I'm going to pass the value so bar my
12:49
value so bar my
12:49
value so bar my job equals new my job I'm going to
12:52
job equals new my job I'm going to
12:52
job equals new my job I'm going to create this job right let's name it
12:56
create this job right let's name it
12:56
create this job right let's name it hello right or something it could be a
12:59
hello right or something it could be a
12:59
hello right or something it could be a good it could be it could have other
13:03
good it could be it could have other
13:03
good it could be it could have other properties again it depends on your
13:06
properties again it depends on your
13:06
properties again it depends on your requirements this case I'm just
13:08
requirements this case I'm just
13:08
requirements this case I'm just wna I just want to use this uh my job as
13:12
wna I just want to use this uh my job as
13:12
wna I just want to use this uh my job as it
13:13
it
13:13
it is my job
13:17
is my job
13:17
is my job and bar
13:19
and bar
13:19
and bar serialized data or
13:22
serialized data or
13:22
serialized data or something and then let's pass serialized
13:27
something and then let's pass serialized
13:27
something and then let's pass serialized data here
13:29
data here
13:29
data here as you can see here on the screen you
13:31
as you can see here on the screen you
13:31
as you can see here on the screen you can also
13:32
can also
13:32
can also have
13:34
have
13:34
have um uh starting from repeats if you want
13:38
um uh starting from repeats if you want
13:38
um uh starting from repeats if you want to repeat the
13:40
to repeat the
13:40
to repeat the thing of course you have the
13:42
thing of course you have the
13:42
thing of course you have the cancellation token and some other things
13:45
cancellation token and some other things
13:45
cancellation token and some other things okay so serialized
13:47
okay so serialized
13:47
okay so serialized data and I need to wait for this since
13:51
data and I need to wait for this since
13:51
data and I need to wait for this since it's an asynchronous
13:54
it's an asynchronous
13:54
it's an asynchronous task and take into account that this is
13:58
task and take into account that this is
13:58
task and take into account that this is an Al
14:00
an Al
14:00
an Al version that's why it's telling me
14:04
version that's why it's telling me
14:04
version that's why it's telling me hey
14:06
hey
14:06
hey cs06
14:08
cs06
14:08
cs06 18 the API is currently not stable
14:12
18 the API is currently not stable
14:12
18 the API is currently not stable that's okay doesn't matter okay I want
14:15
that's okay doesn't matter okay I want
14:15
that's okay doesn't matter okay I want to use
14:16
to use
14:17
to use this um you can
14:19
this um you can
14:19
this um you can also
14:21
also
14:21
also use this refactoring tool to suppress
14:24
use this refactoring tool to suppress
14:24
use this refactoring tool to suppress the message if you want to okay
14:29
the message if you want to okay
14:29
the message if you want to okay that's not
14:30
that's not
14:30
that's not necessary of
14:32
necessary of
14:32
necessary of course okay finally let's return
14:35
course okay finally let's return
14:35
course okay finally let's return something okay that's
14:38
something okay that's
14:38
something okay that's fine and that is it this code is going
14:43
fine and that is it this code is going
14:43
fine and that is it this code is going to schedule the job that is this object
14:48
to schedule the job that is this object
14:48
to schedule the job that is this object right and we need some way to tell
14:53
right and we need some way to tell
14:53
right and we need some way to tell Dapper hey this is the Callback this is
14:56
Dapper hey this is the Callback this is
14:56
Dapper hey this is the Callback this is the end point that I want you to execute
15:01
the end point that I want you to execute
15:01
the end point that I want you to execute when the schedule comes right when the
15:04
when the schedule comes right when the
15:04
when the schedule comes right when the schedule job kicks
15:07
schedule job kicks
15:07
schedule job kicks in so I'm going to do that here in the
15:09
in so I'm going to do that here in the
15:09
in so I'm going to do that here in the program. Cs file app map dopper schedule
15:15
program. Cs file app map dopper schedule
15:16
program. Cs file app map dopper schedule job
15:17
job
15:17
job Handler and as you can see here you need
15:20
Handler and as you can see here you need
15:20
Handler and as you can see here you need to pass this
15:23
delegate right and then you can also
15:27
delegate right and then you can also
15:27
delegate right and then you can also optionally pass the
15:29
optionally pass the
15:29
optionally pass the the time span for the
15:31
the time span for the
15:31
the time span for the timeout so I'm gonna pass the
15:34
timeout so I'm gonna pass the
15:34
timeout so I'm gonna pass the action I want to use this Lambda
15:38
action I want to use this Lambda
15:38
action I want to use this Lambda expression right no parameters at all
15:41
expression right no parameters at all
15:41
expression right no parameters at all it's just a
15:42
it's just a
15:42
it's just a regular um basic delegate and here you
15:47
regular um basic delegate and here you
15:47
regular um basic delegate and here you want to do the
15:49
want to do the
15:49
want to do the thing right do the
15:54
thing what is it well remember
16:00
thing what is it well remember
16:00
thing what is it well remember daily data archival right or maybe you
16:03
daily data archival right or maybe you
16:03
daily data archival right or maybe you want to connect to your database or
16:07
want to connect to your database or
16:07
want to connect to your database or maybe to your file system or maybe you
16:09
maybe to your file system or maybe you
16:09
maybe to your file system or maybe you want to send some other messages by
16:12
want to send some other messages by
16:12
want to send some other messages by using the uh pops up building block or
16:18
using the uh pops up building block or
16:18
using the uh pops up building block or maybe you want to use any other kind of
16:21
maybe you want to use any other kind of
16:21
maybe you want to use any other kind of code for executing the thing
16:26
code for executing the thing
16:26
code for executing the thing right in this case I just just want
16:30
right in this case I just just want
16:30
right in this case I just just want to I don't know maybe console right line
16:35
to I don't know maybe console right line
16:35
to I don't know maybe console right line high or
16:39
something right in this case just
16:42
something right in this case just
16:42
something right in this case just imagine connecting to your database or
16:45
imagine connecting to your database or
16:45
imagine connecting to your database or sending emails or again it
16:49
sending emails or again it
16:49
sending emails or again it depends okay so far so
16:52
depends okay so far so
16:52
depends okay so far so good um so first you need to specify
16:57
good um so first you need to specify
16:57
good um so first you need to specify this you need to config your your
16:59
this you need to config your your
16:59
this you need to config your your asp.net core application if you happen
17:01
asp.net core application if you happen
17:01
asp.net core application if you happen to be an asp.net core
17:04
to be an asp.net core
17:04
to be an asp.net core developer you need to execute this so
17:07
developer you need to execute this so
17:07
developer you need to execute this so you can use the dopper jobs client
17:10
you can use the dopper jobs client
17:10
you can use the dopper jobs client object in your
17:12
object in your
17:12
object in your controllers like this I'm injecting the
17:15
controllers like this I'm injecting the
17:15
controllers like this I'm injecting the doer jobs client and then I'm creating
17:18
doer jobs client and then I'm creating
17:18
doer jobs client and then I'm creating the object that represents the job and
17:21
the object that represents the job and
17:21
the object that represents the job and then I'm setting the scheduling
17:24
then I'm setting the scheduling
17:24
then I'm setting the scheduling configuration then I'm sending the job
17:27
configuration then I'm sending the job
17:27
configuration then I'm sending the job to the scheduler
17:29
to the scheduler
17:29
to the scheduler here in line
17:32
here in line
17:32
here in line 18 uh you need to specify a name and
17:35
18 uh you need to specify a name and
17:35
18 uh you need to specify a name and that is it that is actually
17:39
that is it that is actually
17:39
that is it that is actually it okay so far so good let's do the
17:47
following let's execute the dopper side
17:50
following let's execute the dopper side
17:50
following let's execute the dopper side car so dopper
17:53
car so dopper
17:53
car so dopper run and app ID let's name IT jobs and
17:58
run and app ID let's name IT jobs and
17:58
run and app ID let's name IT jobs and then topper HTTP Port it's going to be
18:03
then topper HTTP Port it's going to be
18:03
then topper HTTP Port it's going to be 5500 and then app
18:05
5500 and then app
18:05
5500 and then app Port let's say 55 0 this is 55,000 right
18:12
Port let's say 55 0 this is 55,000 right
18:12
Port let's say 55 0 this is 55,000 right and then
18:14
5500 and
18:17
5500 and
18:17
5500 and net run and URLs HTTP since I want to be
18:23
net run and URLs HTTP since I want to be
18:23
net run and URLs HTTP since I want to be sure that this application is running in
18:25
sure that this application is running in
18:25
sure that this application is running in this
18:26
this
18:26
this port make sense
18:30
port make sense
18:30
port make sense in other
18:31
in other
18:31
in other words I'm just executing the topper side
18:34
words I'm just executing the topper side
18:34
words I'm just executing the topper side car alongside my application just like
18:37
car alongside my application just like
18:37
car alongside my application just like any other regular topper application in
18:40
any other regular topper application in
18:40
any other regular topper application in the
18:41
the
18:41
the past
18:42
past
18:42
past okay so let's execute this
18:50
and this is
18:52
and this is
18:52
and this is running it's running
18:56
running it's running
18:56
running it's running right so if telling me hey hi hi hi hi
19:00
right so if telling me hey hi hi hi hi
19:00
right so if telling me hey hi hi hi hi because I made some
19:03
because I made some
19:03
because I made some uh uh previous
19:06
uh uh previous
19:06
uh uh previous tests uh let's go here and let's change
19:10
tests uh let's go here and let's change
19:10
tests uh let's go here and let's change the name let's change this stram
19:14
the name let's change this stram
19:15
the name let's change this stram hello this is the job
19:21
executing make sense
19:24
executing make sense
19:24
executing make sense since I was running the same application
19:28
since I was running the same application
19:28
since I was running the same application before
19:29
before
19:29
before so let's ex execute this
19:34
again so okay hello this is the job
19:37
again so okay hello this is the job
19:37
again so okay hello this is the job executing can you see
19:40
executing can you see
19:40
executing can you see this and this is because I
19:44
this and this is because I
19:44
this and this is because I scheduled the job in the Dapper
19:48
scheduled the job in the Dapper
19:48
scheduled the job in the Dapper scheduler remember that Dapper scheduler
19:52
scheduler remember that Dapper scheduler
19:52
scheduler remember that Dapper scheduler service is running as an um Docker
19:57
service is running as an um Docker
19:57
service is running as an um Docker container speaking of which that
20:00
container speaking of which that
20:00
container speaking of which that scheduling information is being stored
20:03
scheduling information is being stored
20:03
scheduling information is being stored in this it City database that is a key
20:07
in this it City database that is a key
20:07
in this it City database that is a key value database quite famous in the
20:10
value database quite famous in the
20:10
value database quite famous in the kubernetes
20:12
kubernetes
20:12
kubernetes ecosystem since this is a database this
20:14
ecosystem since this is a database this
20:14
ecosystem since this is a database this is the same storage that kubernetes uses
20:18
is the same storage that kubernetes uses
20:18
is the same storage that kubernetes uses for um storing the control plane data
20:22
for um storing the control plane data
20:22
for um storing the control plane data and all the things related to that
20:25
and all the things related to that
20:25
and all the things related to that cluster so in a similar fashion the
20:29
cluster so in a similar fashion the
20:29
cluster so in a similar fashion the scheduler is
20:31
scheduler is
20:31
scheduler is storing the jobs in ET CD and that's
20:36
storing the jobs in ET CD and that's
20:36
storing the jobs in ET CD and that's why this is executing and it was
20:39
why this is executing and it was
20:39
why this is executing and it was executing the other um the other jobs
20:43
executing the other um the other jobs
20:43
executing the other um the other jobs that I had
20:47
beforehand so this is great take into
20:51
beforehand so this is great take into
20:51
beforehand so this is great take into account that the diaper schedu or
20:54
account that the diaper schedu or
20:54
account that the diaper schedu or service must be running as I mentioned
20:56
service must be running as I mentioned
20:56
service must be running as I mentioned before
20:59
before
20:59
before and this is important that's why we're
21:03
and this is important that's why we're
21:03
and this is important that's why we're not gonna see
21:05
not gonna see
21:05
not gonna see high in the console again since I
21:10
high in the console again since I
21:10
high in the console again since I replaced the job that I had
21:14
replaced the job that I had
21:14
replaced the job that I had beforehand and this is because when you
21:17
beforehand and this is because when you
21:17
beforehand and this is because when you create a job any existing job with the
21:19
create a job any existing job with the
21:19
create a job any existing job with the same name will be replaced okay makes
21:23
same name will be replaced okay makes
21:23
same name will be replaced okay makes sense
21:25
sense
21:25
sense so that's why it was replaced since I
21:30
so that's why it was replaced since I
21:30
so that's why it was replaced since I was using the same job
21:33
was using the same job
21:33
was using the same job name and if I go back here to the
21:35
name and if I go back here to the
21:35
name and if I go back here to the terminal you can see that this job is
21:38
terminal you can see that this job is
21:38
terminal you can see that this job is executing every
21:43
minute Mak
21:45
minute Mak
21:45
minute Mak sense so this is the jobs
21:48
sense so this is the jobs
21:48
sense so this is the jobs API and the jobs SDK for.net
21:52
API and the jobs SDK for.net
21:52
API and the jobs SDK for.net quite easy to
21:55
quite easy to
21:55
quite easy to use um and you can easily see how to
21:59
use um and you can easily see how to
21:59
use um and you can easily see how to implement this in your own
22:01
implement this in your own
22:01
implement this in your own applications just implement the job
22:06
applications just implement the job
22:06
applications just implement the job itself and then you specify the code
22:08
itself and then you specify the code
22:08
itself and then you specify the code that you want to execute when the
22:12
that you want to execute when the
22:12
that you want to execute when the scheduling kicks
22:15
scheduling kicks
22:15
scheduling kicks in
22:17
in
22:17
in okay and that is it friends uh this is
22:21
okay and that is it friends uh this is
22:21
okay and that is it friends uh this is actually a very short
22:23
actually a very short
22:23
actually a very short session
22:25
session
22:25
session um and if you want to know more about
22:31
um and if you want to know more about
22:31
um and if you want to know more about Dapper I totally recommend to
22:35
Dapper I totally recommend to
22:35
Dapper I totally recommend to you uh you can watch the previous
22:38
you uh you can watch the previous
22:38
you uh you can watch the previous episodes in the dopper in action series
22:41
episodes in the dopper in action series
22:41
episodes in the dopper in action series here at CP live C TV
22:46
here at CP live C TV
22:46
here at CP live C TV live and let me show you actually the
22:49
live and let me show you actually the
22:49
live and let me show you actually the web
22:50
web
22:50
web page where you can go ahead and see the
22:54
page where you can go ahead and see the
22:54
page where you can go ahead and see the rest of episodes
22:56
rest of episodes
22:56
rest of episodes c.com okay
22:59
c.com okay
22:59
c.com okay and you can see the rest of um episodes
23:05
and you can see the rest of um episodes
23:05
and you can see the rest of um episodes here amazing amazing friends as you can
23:09
here amazing amazing friends as you can
23:09
here amazing amazing friends as you can hear me my voice is struggling that's
23:12
hear me my voice is struggling that's
23:12
hear me my voice is struggling that's why this session was very short however
23:15
why this session was very short however
23:15
why this session was very short however this was the
23:17
this was the
23:17
this was the jobs
23:18
jobs
23:18
jobs topic um and again if you want to know
23:22
topic um and again if you want to know
23:22
topic um and again if you want to know more about Dapper you can go back in
23:25
more about Dapper you can go back in
23:25
more about Dapper you can go back in time and watch the other episodes of the
23:28
time and watch the other episodes of the
23:28
time and watch the other episodes of the dapper in action
23:29
dapper in action
23:29
dapper in action series my name is Rodrigo and thank you
23:33
series my name is Rodrigo and thank you
23:33
series my name is Rodrigo and thank you for your time and see you next week
23:38
for your time and see you next week
23:38
for your time and see you next week [Music]
#Jobs
#Windows & .NET


