✅ MassTransit with RabbitMQ Exception
Hi friends,
I'm working on a project using
Microservices
, in this project I have ExpenseService
( which divided to 4 projects Domain, Infraastructure, Application and API ), and AuthService
.
AuthService is used for authentication and user management, the ExpenseService
needs to store some info about a User
in its own database, so for this when a user is created in AuthService
the AuthService publish a UserCreatedMessage
/Event to RabbitMQ
using MassTransit
, the ExpenseService
is a subscriber in the Queue
if that message.
The issue :
When I start the both services everything going fine but when I create a user using the AuthService
API the User is created and stored in the AuthService database, after that a UserCreatedMessage
/Event should be published, but instead I get an Exception in the API that said :
The entity name must not be null or emptyand in
VS Code
debugging console I get this exception
Exception thrown: 'MassTransit.RabbitMqAddressException' in MassTransit.RabbitMqTransport.dll Exception thrown: 'MassTransit.RabbitMqAddressException' in System.Private.CoreLib.dllThis means that the message is not published because of an issue in
MassTransit
Configs I did.7 Replies
AuthService program.cs:
ExoenseService program.cs:
Please I hope someone to provide a help <3
it only seems like a configuration issue on ur services side if the host and/or port are wrong
my first step would be to use some rabbitmq health check tool to see if rabbitmq is actually set up correctly.
since 15672 seems to be an http port it might also be that rabbitmq is only listening on a specific domain, and refuses on different hosts (HTTP Host header basically)
scratch the last part, that cant be it, because ur client isnt even able to send headers yet
basically this should give some hints whats going wrong: https://www.rabbitmq.com/troubleshooting-networking.html
I appreciate your time and help, I fixed it by changing the
DI
registration in program.cs
to :
glad ya found the issue o7
if this fully answers ur question please dont forget to $close this thread
Use the /close command to mark a forum thread as answered