TxQueueContainer

Wrapper classes around inversifyJS container library. You can create a component by inject all its dependencies.

usages

  • Create a component Q1Component using TxQueueContainer injector.

// define a component something like this.
  @injectable()
  export class Q1Component {
    @inject(TxTYPES.TxQueuePoint) queuepoint;
 
    constructor() {
    }
 
    async init() {
      ...
    }
  }
 
  // prepare injector for Q1Component - this done one time.
  TxQueueContainer.setDriver(TxConnectorRabbitMQ); // optional, otherwise use default TxConnectorRabbitMQ
  TxQueueContainer.addComponent<Q1Component>(Q1Component, 'Q1Component');
     
  // create new 'Q1Component' component under the name 'Q1COMPONENT::QUEUE::CONTAINER'
  co = TxQueueContainer.get('Q1Component', 'Q1COMPONENT::QUEUE::CONTAINER');
 
  // send something to queue.
  co.queuepoint.queue.next(..);
  • Create a component Q2 which has some other member in it.

Last updated