+ createJobWithChildren (parent: CreateJobArgument & CreateJobOptions, children: (CreateJobArgument & CreateJobOptions)[]) {
+ return this.flowProducer.add({
+ ...this.buildJobFlowOption(parent),
+
+ children: children.map(c => this.buildJobFlowOption(c))
+ })
+ }
+
+ private buildJobFlowOption (job: CreateJobArgument & CreateJobOptions): FlowJob {
+ return {
+ name: 'job',
+ data: job.payload,
+ queueName: job.type,
+ opts: {
+ failParentOnFailure: true,
+
+ ...this.buildJobOptions(job.type as JobType, pick(job, [ 'priority', 'delay', 'failParentOnFailure' ]))
+ }
+ }
+ }
+