DEV Community

CQRS In Microservices - A Practical Example

James Eastham on November 04, 2019

In my last post, I went through a thought experiment regarding CQRS across separate microservices. This breaks a lot of my conceptions around micr...
Collapse
 
thatham profile image
Venkatesh Thatham

I'm unable to publish an event using IPublishEndpoint from ConsumerContext instance. The source code can be found here github.com/thatham/test

Appreciate your valuable suggestion

Collapse
 
jeastham1993 profile image
James Eastham

Sorry if I've missed the code, but it looks like you have a hosted service for your BusControl (github.com/thatham/test/blob/maste...) but you never actually add the hosted service to your Startup.cs...

Collapse
 
thatham profile image
Venkatesh Thatham

It is mentioned here in a method called "services.AddRabbitMQDependencies()" in startup.cs

Thread Thread
 
jeastham1993 profile image
James Eastham

I see that now, thanks for pointing that out.

What exactly isn't working?

Thread Thread
 
thatham profile image
Venkatesh Thatham

If you try to execute the tenant->post of service project, the message will be sent using "endpoint.Send" method. I also have a consumer class (Handler in CQRS) for the command, upon receiving the message the event will be registered in presisted event store database(here it's cosmos DB).

Then, I try to publish an event using IPublishEndpoint which is not working.

Thread Thread
 
thatham profile image
Venkatesh Thatham

Looking forward to be hearing from you...