Message Queue

Rize uses a message queue to communicate real time events to the APIs, you can see all the events Rize communicates here.

Linker APIs connect to Rize's message queue using Stomps, with a custom transporter.

You can connect to any Rize event by adding a Topic.EVENT_NAME into the topicsToSubscribe array in src/main.ts file.

Here's an example:

app.connectMicroservice({
  strategy: new RizeStompTransporter({
    topicsToSubscribe: [
      Topic.TRANSACTION,
      Topic.SYNTHETIC_ACCOUNT,
      Topic.DEBIT_CARD,
      Topic.CUSTOMER,
    ],
  }),
});

Once added into the array, you have to create an endpoint to listen to the event in src/baas/rize/rize-mq/rize-mq.controller.ts:

@MessagePattern(`${rizeTransporterPrefix}.${Topic.EVENT_NAME}`)
eventName(@Payload() eventData: MqCustomer): void {
    console.log('CUSTOMER');
    this.rizeMqService.eventNameEvents(eventData.data);
}

And also create the service method to handle the logic in src/baas/rize/rize-mq/rize-mq.service.ts:

async eventNameEvents(data: MqSyntheticAccount['data']) {
  return;
}

Last updated