.NET: Microsoft Technologies based on the .NET software framework. Runtime: An environment required to run apps that aren't compiled to machine language.
Hi @Boddu, Yashwanth ,
Thanks for reaching out.
It looks like the main issue is that your OutboundCommunicationEventHub class is trying to implement the same generic interface IAsbMessageProcessor twice with different types (EmailRequestMessage and SMSRequestMessage). In C#, this isn’t allowed because both implementations define a ProcessMessage method with the same name, which causes a conflict. That’s why your service never gets the messages.
To resolve this, you have a few options:
- Create one class to handle emails and another for SMS. Each class implements
IAsbMessageProcessor<T>for its specific type. This is the simplest approach and keeps things clear. - Define a common interface without the generic parameter, then have each message type implement it. Your handler can then work with the base interface and delegate to the correct processor internally.
- Keep one central class that receives all messages but routes them to the appropriate processor based on the message type.
Option 1 is usually the quickest to get working, while options 2 or 3 give more flexibility if you plan to handle more message types in the future.
Hope this helps! If my answer was helpful - kindly follow the instructions here so others with the same problem can benefit as well.