►
Description
In this video we see how the Microsoft Graph SDK becomes really helpful whenever you want to properly handle throttling related issues when consuming the Microsoft Graph in .NET.
Here you can find additional details:
- https://learn.microsoft.com/en-us/azure/architecture/patterns/throttling
- https://learn.microsoft.com/en-us/graph/throttling
And here you can find the sample app illustrated in the video:
- https://github.com/PiaSys/Conferences-Samples/tree/master/M365Proxy/DotNetThrottlingGraphSDK
A
A
Today
we
keep
on
talking
about
how
we
can
handle
throttling
when
developing.net,
Solutions
and
I
want
to
show
you
how
you
can
benefit
of
the
micrograph
SDK,
which
automatically
retries
up
to
four
times
for
you
whenever
you
get
a
throttling
exception
when
consuming
the
Maxwell
graph.
Of
course,
after
the
fourth
retry,
it
will
still
give
you
back.
An
invalid
operation
exception
that
you
should
handle
properly,
but
at
least
the
graph
SDK
will
try
to
do
its
best
to
help
you
handle
automatically
all
of
the
throttling
related
issues.
A
Of
my
solution,
I'm
using
micrographer,
as
well
as
the
extensions
for
hosting
and
having
the
dependence
injection
in
place
so
I
configure
logging,
I,
configure
the
services
and
in
the
section
where
I
configure
the
services
I
simply
read
the
client
ID
and
the
Tenant
ID,
as
well
as
the
Scopes
from
the
settings
of
my
application,
and
here
I'm
just
consuming
my
target
tenant
providing
sdiscope
the
user.read
permissions
code.
Then
I
use
the
azure.identity
package
to
do
the
authentication
and
specifically
I
use
the
interactive
browser.
Credential
authentication
model
so
that
I
will
use
the
browser-based
interactive.
A
My
application,
I
can
simply
get
the
service
instance
of
the
grass
service,
client
and
I
can
use
the
me
and
point
to
get
the
information
about
my
user,
of
course,
in
case
of
any
failure
related
to
too
many
retries
so
to
throttling
I
will
intercept
the
invalid
operation
exception
and
I
will
say
that
I
have
been
throttled
and
again
show
the
detailed
information
about
the
exception
that
we
look
for.
So
let
me
run
this
application
with
Ctrl
F5.
As
such,
you
will
see
the
application
running
interactively
on
my
screen.
A
So
here
is
the
console
application
running
and
here
I
have
the
browser
to
do
the
authentication
I'm
authenticated
I
can
go
back
to
the
application
and
I
can
see
my
username,
so
it
works.
Indeed.
Now,
let's
enable
the
micro
35
developer
proxy
to
play
with
throttling
with
a
proper
tool
that
will
help
me
to
investigate
any
throttling
relation
related
issues.
So
let
me
start
the
proxy
with
a
failure
rate
of
100,
so
all
of
the
requests
will
fail
now
and
will
fail
with
throttling.
A
So
let
me
go
back
to
my
application,
and
now
we
can
see
that
we
can
run
it
again
still
with
the
Ctrl
F5,
for
the
sake
of
Simplicity.
I
can
log
in
with
my
account,
and
there
is
my
application,
and
here
is
the
proxy.
So,
as
you
can
see
now,
the
application
is
trying
to
make
a
request
to
micrograph
and
the
other
proxy
is
returning
back
a
chaos
with
a
429
exception.
First
request.
A
Second
retry
third
retry,
we
still
don't
see
any
exception,
and
then
we
will
have
a
fourth
retry,
and
now
we
see
an
exception.
We,
you
have
been
throttled
and
I,
see
that
the
inner
exception
message
is
more
than
three
retries
encountered,
while
sending
the
request.
Of
course,
we
can
also
lightly
change.
Like
always,
the
behavior
of
the
proxy
and
I
can
say
that
I
want
a
failure
rate
of
40
percent.
So
let
me
do
that.
A
Let
me
run
the
proxy
again
and
let
me
restart
the
application,
so
we
can
now
see
that
the
application
will
retry
up
to
four
times.
So
here
we
are
here
is
the
application
willing
to
authenticate
the
user,
and
let
me
do
that,
but
now,
if
I
will
go
back
to
the
proxy,
we
can
see
that
we
have
got
one
request
and
actually
we
are
so
lucky
that
the
very
first
one
was
the
successful
one,
and
so
we
have
got
the
response.
A
We
can
even
try
one
more
time
and
see
if
we
can
see
some
retries
and
then
the
successful
response.
It
is
really
about
statistics,
but
now
here
we
have
the
application.
Here
we
authenticate
again
here
we
see
the
request
running
and,
of
course,
we
are
so
lucky
that
we
always
get
the
response,
but
doesn't
really
matter.
We
can
see
that
using
the
max35
developer
proxy,
we
can
simulate
the
throttling
exception
and
we
can
see
if
we
properly
handle
it
in
our
code,
even
using
the
graph
SDK,
which
does
a
lot
of
work
for
us
automatically.