0:00 So in this lecture, we're gonna refactor our abstract 0:05 producer to actually be able to support batch 0:09 message producing. And so what this is gonna do, it's gonna allow us to 0:13 pass an array of messages in a single 0:16 GraphQL request to execute the underlying job, and inside of this 0:20 single request, we can include 0:24 an array type inside of our data that we're passing 0:28 to the job. So if we take a look at our 0:32 jobs resolver, 0:36 right we know our executeJobInput is taking in this JSON data 0:40 object. This can also be what we wanna change it 0:43 to, a 0:44 array type. So similarly, it can be an object or 0:48 array. So let's update this a type here by saying 0:52 it can 0:52 be an object, or it can be an object array 0:56 type. We're also gonna go ahead and remove the is 1:00 object decorator because it can be an object or an array, 1:04 and this array of data is going to be the batch of messages 1:08 that we want to 1:08 produce to the underlying job. 1:11 Now, as we're gonna see, this is gonna be much more efficient than of 1:14 having to 1:15 call this executeJobMutation over and over again, each 1:19 time with just a single data object. 1:21 Instead, if we can include an array of data 1:24 objects, 1:25 each one being a separate message, a separate job that we're executing on 1:29 the underlying job, then we can send these messages in a batch 1:33 using 1:33 our Pulsar producer, which is going to be much more efficient than 1:37 sending them one at a time. 1:40 Now, as we'll see later on, it's important that we can support this 1:43 batch 1:43 producing to actually be able to generate a backlog of 1:47 messages on our topic. Now, this backlog of messages on the topic 1:51 is gonna be key to be able to see the advantages of using this
The rest of the transcript is for members.
Sign in