Closed shurik239 closed 8 years ago
Assuming that send/receive bus implements command pattern
basically, yes... a command pattern can be implemented with the send/receive objects.
add possibility for Receiver to answer to Sender, just to let Sender know, that command was consumed succesfully.
i typically use an asynchronous status update to handle this...
In this scenario both App1 and App2 are setup to be message producers and consumers, so that they can communicate with each other asynchronously.
would that work in your scenario? or is there a specific need to have a command handler send a response? (which sounds like a Request/Response scenario, off-hand...)
After much thought and reflection, I would say, yes that would work for my scenario, unless corelationId is not working as expected. I will try this.
@shurik239 correlationId has no direct functionality in RabbitMQ / AMQP. It's just a field that you can use for whatever purpose you want.
The intention, however, is to provide an ID that allows you to correlate a single message to a larger part of the system - whether it's a series of messages, or knowing which object sent the message or whatever it is.
I use correlationId to send a message as a command and to have a response sent back to the command originator, with a status for the command's execution. But I have to manage the correlationId myself.
This article I wrote describes the scenario in fair detail, including the use of correlationId and a workflow manager object that knows how to take advantage of that Id: http://derickbailey.com/2015/08/10/managing-workflow-in-long-running-javascript-processes/
again very usefull info from you! Thanks, Derick!
What i am thinking about, is to join this approach with finite state machine pattern
+1 to that
personally, i have a bad history with FSMs... i keep messing them up. but i know that it's just me, and I know the FSM pattern can make these long running processes very easy to manage!
there are plenty of FSM implementations for node, out there. and you may want to look at machina.js - the FSM used inside of wascally https://github.com/ifandelse/machina.js
closing this ticket for now - feel free to reach out with other questions or issues, though!
Feature Request: Assuming that send/receive bus implements command pattern, where it can be few producers but only one consumer, IMHO, it make sense, to add possibility for Receiver to answer to Sender, just to let Sender know, that command was consumed succesfully.