0:00 Now to actually wire this circuit breaker in, we are gonna go back to our 0:03 HTTP service. 0:05 Remember, in the constructor here, this is where we're actually creating the 0:09 underlying Axios instance that is used application-wide, 0:13 and we're already wrapping it in create Axios instance from our 0:17 factory, where, as you remember, we apply our 0:21 HTTP keep alive as well as Axios retry functionality. 0:25 Now, this is great that we have this because at this point, 0:28 we have the underlying 0:29 instance. That's what we need for this next stage of 0:32 composition, 0:33 where we're going to wrap the breaker inside of 0:37 the circuit breaker using almost like a decorator pattern. 0:41 So at this point in the constructor, we have the instance. 0:44 Now what we wanna do is 0:46 create the HTTP breaker that's gonna be another member variable 0:50 of the class. So we have the instance. 0:52 We'll also now declare the 0:55 breaker, 0:56 which will be of type HTTP breaker from the factory that we've just set up. 1:00 And now what we wanna do is set this.breaker equal to 1:04 createHttpCircuitBreaker. Here we pass in the underlying 1:08 Axios instance that we've already configured, 1:11 and then the underlying dynamic 1:12 options which come from... Well, in this case, we need this 1:16 defined on the HTTP options. So let's head back 1:20 into HTTP module options where we have our circuit breaker 1:24 options, but now we need to add them to our 1:27 HTTP module options. So for this, I'll simply add a 1:31 new circuit breaker parameter, 1:35 which will be the optional circuit breaker options here 1:38 that allow us to configure it dynamically at module runtime. 1:41 And so now 1:43 we can pass through back in the HTTP service, the underlying circuit 1:47 breaker options, which allows us to configure it. 1:50 And this is wonderful. We have the breaker now available.
The rest of the transcript is for members.
Sign in