You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// register the service providerconstprovider=newServiceProvider().register();// resolve the class by it's identifierconstlogger=provider.resolve("Logger");logger.info("Successfully injected the Logger");
4. Consumer | ./src/Consumers/ExampleConsumer.ts
exportdefaultclassExampleConsumerextendsConsumer{publicstaticinject=["ExampleRequestHandler",// <-- The new RequestHandler"ExampleConsumerConfig",// <-- The new ConsumerConfig]asconst;publicconstructor(privatereadonlyrequestHandler: RequestHandler,protectedreadonlyconfig: ConsumerConfig){super(config);}publichandler(){returnthis.requestHandler.handle;// Just return the handle method}}
5. Execute the consumer | ./src/Infrastructure/Application.ts
awaitthis.exampleConsumer.consume(connection);
6. Testing the consumer
Run yarn fake to send 10 fake message to the example_queue.