@@ -19,6 +19,7 @@ export class workflow_in_node {
1919 public con : amqp_consumer ;
2020 public host : string = null ;
2121 public workflow : any ;
22+ public queue : string = "" ;
2223 constructor ( public config : Iworkflow_in_node ) {
2324 RED . nodes . createNode ( this , config ) ;
2425 try {
@@ -35,11 +36,11 @@ export class workflow_in_node {
3536 await this . init ( ) ;
3637 this . node . status ( { fill : "blue" , shape : "dot" , text : "Connecting..." } ) ;
3738
39+ this . queue = this . config . queue ;
3840 if ( ! NoderedUtil . IsNullUndefinded ( Config . queue_prefix ) ) {
39- this . config . queue = Config . queue_prefix + this . config . queue ;
41+ this . queue = Config . queue_prefix + this . config . queue ;
4042 }
41-
42- this . con = new amqp_consumer ( Logger . instanse , this . host , this . config . queue ) ;
43+ this . con = new amqp_consumer ( Logger . instanse , this . host , this . queue ) ;
4344 this . con . OnMessage = this . OnMessage . bind ( this ) ;
4445 await this . con . connect ( false ) ;
4546 this . node . status ( { fill : "green" , shape : "dot" , text : "Connected" } ) ;
@@ -48,9 +49,9 @@ export class workflow_in_node {
4849 }
4950 }
5051 async init ( ) {
51- var res = await NoderedUtil . Query ( "workflow" , { "queue" : this . config . queue } , null , null , 1 , 0 , null ) ;
52+ var res = await NoderedUtil . Query ( "workflow" , { "queue" : this . queue } , null , null , 1 , 0 , null ) ;
5253 if ( res . length == 0 ) {
53- this . workflow = await NoderedUtil . InsertOne ( "workflow" , { _type : "workflow" , "queue" : this . config . queue , "name" : this . config . name } , 0 , false , null ) ;
54+ this . workflow = await NoderedUtil . InsertOne ( "workflow" , { _type : "workflow" , "queue" : this . queue , "name" : this . config . name } , 0 , false , null ) ;
5455 } else {
5556 this . workflow = res [ 0 ] ;
5657 }
@@ -114,7 +115,7 @@ export class workflow_in_node {
114115 //result = result.payload;
115116 } else {
116117 var res2 = await NoderedUtil . InsertOne ( "workflow_instances" ,
117- { _type : "instance" , "queue" : this . config . queue , "name" : this . workflow . name , payload : data . payload , workflow : this . workflow . _id } , 1 , true , data . jwt ) ;
118+ { _type : "instance" , "queue" : this . queue , "name" : this . workflow . name , payload : data . payload , workflow : this . workflow . _id } , 1 , true , data . jwt ) ;
118119 //result = Object.assign(res2, result);
119120 result = this . nestedassign ( res2 , result ) ;
120121 }
0 commit comments