Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency Injection #2

Open
CaoAnhDev opened this issue Apr 14, 2023 · 2 comments
Open

Dependency Injection #2

CaoAnhDev opened this issue Apr 14, 2023 · 2 comments

Comments

@CaoAnhDev
Copy link

Hi, can I ask: why the constructor never be called?

@Injectable()
export class MessageHandler {
  constructor(
    // @Inject(SubscriptionService)
    // private subscriptionService: SubscriptionService,
    // @Inject(NotificationService)
    // private notificationService: NotificationService,
    private readonly supabase: Supabase,
  ) {
    console.log('debug-initial', supabase);
  }

@CaoAnhDev
Copy link
Author

And how can I inject a service into MessageHandler, something I wanna ask is:


@Injectable()
export class MessageHandler {
  constructor(private readonly subapase: Supabase) {}

  @SqsMessageHandler(awsConfig.name, false)
  async handleMessage(message: AWS.SQS.Message) {
   // call an service something like that
    // DatabaseService.storeMessage(message)
  }
}

@CaoAnhDev
Copy link
Author

@evanhameed99 please help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant