app.js 742 B

12345678910111213141516171819202122232425262728
  1. 'use strict';
  2. class AppBootHook {
  3. constructor(app) {
  4. this.app = app;
  5. }
  6. async didReady() {
  7. // 应用已经启动完毕
  8. const ctx = await this.app.createAnonymousContext();
  9. // 企业入驻申请消息接收事件
  10. await ctx.service.rabbitmq.receiveQueueMsg('public_chat');
  11. }
  12. async serverDidReady() {
  13. // 应用已经启动完毕
  14. }
  15. }
  16. module.exports = AppBootHook;
  17. // module.exports = app => {
  18. // app.messenger.on('mq_action', data => {
  19. // console.log('------------------------------->app-start');
  20. // // 应用已经启动完毕
  21. // const ctx = app.createAnonymousContext();
  22. // // 企业入驻申请消息接收事件
  23. // ctx.service.rabbitmq.receiveQueueMsg('stu_import');
  24. // });
  25. // };