Masstransit request response1/4/2023 A little more digging and I find out that I am not setting all the fields on the response message withing the command handler before sending it back to the UI. Specifically an exception thrown by the NewtonSoft Json serializer - it can't deserialize my message. I go back to my original solution and decide to debug the Nancy UI, turn on exceptions break where thrown. The UI sends a request and the command handler echos it back. The next thing to do was to write a really simple Nancy UI and a really simple command handler service communicating via MassTransit. Now I am thinking that I am doing something wrong. I checked out the MassTransit Google Group and discovered that an issue had been reported with Request/Response in ASP.NET - I am hosting my Nancy UI in ASP.NET - so this got me thinking that this was my problem, even though it was reported as fixed in v2.7 of MT. There were no exceptions being thrown or swallowed by the command handler - it was all working, and yet I was not recieving the response back in the UI. The problem was that my UI would time out, but I could also see that nothing went wrong in my command handler since I can see the events being propagated to the event bus. At this point, assuming nothing went wrong in the command handler, the command handler will send a response back to the client. Commands are processed against the domain model (DDD style), the domain model will raise events that are then persisted in an event store, and the events are published on an event bus. I have the UI sending commands in a synchronous fashion using the Request/Response pattern in MassTransit to a command handling service. I have a simple UI, web based using NancyFX. So it seems Consumer 1 keeps executing, but I don't understand why if the message type is different for each consumer and the client is not calling for it.This took me a couple of days to figure out! Now lets say I have Consumer1, Consumer2 and Consumer3. I added the following logging line to each consumer so I know is being run. Using RabbitMQ (3.8.16) as message broker. Response = await client.GetResponse(new ConceptB圜onceptNoRequest(). static async Task GetB圜onceptNo(AutofacServiceProvider autoFac, short ksrsId, short conceptNo, ILogger logger) The only difference being the request-response types. This is the client request and response code, which is pretty much the same for all my checks. MASSTRANSIT REQUEST RESPONSE CODE(MassTransit.ReceiveTransport.)-SKIP rabbitmq://192.168.0.25/DESKTOP99KLG9M_Tests_bus_5r5yyygxmpry6jgtbdctpqurrb?temporary=true d9360000-cf5b-480f-ce25-08d916ba75f3ĭon't understand the skip when I still get the response, the response is as expected and the code can move on. Here is the masstransit log for the 2nd request. What I am noticing is that the first request-response works fine, but when the code runs the next checks the response is received but the message is then moved to the skipped queue and deleted. To test each consumer, I created a console app that executes a request for each consumer and checks the response. So I have multiple consumers on a service that listens for different requests to do simple tasks, like grab data from a database. I have seen something a bit odd when using MassTransit with request-response. I couldn't see anything to say this is normal behaviour, so excuse me if I am blind lol.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |