Command pattern - How to preserve execution state?
I have the folowing opertaion. I need to create a reservation, during the create of reservation I need to orchestrate several things. The reservation is ordered through a third party system, then an e-mail is sent , then a price offer is finalized and so on...
Can I encapuslate this logic in a single CreateReservationCommand or I need to have three commands and then what pattern would orchestrate the command execution ? Can a command has execution state at all ?
Also I have the feeling that the Command in the sense of gang of four is different than the Command in the sense of CQRS for example. Am I right ?
UPDATE:
What makes me confused here is that in terms of CQRS you can have a commands and events and lets supposed that third party system sends a message to my system CREATE_RESERVATION wouldn't this in the context of CQRS be a command and yet this is more of a complete workflow probably SAGA pattern ?
design-patterns architecture domain-driven-design cqrs command-pattern
add a comment |
I have the folowing opertaion. I need to create a reservation, during the create of reservation I need to orchestrate several things. The reservation is ordered through a third party system, then an e-mail is sent , then a price offer is finalized and so on...
Can I encapuslate this logic in a single CreateReservationCommand or I need to have three commands and then what pattern would orchestrate the command execution ? Can a command has execution state at all ?
Also I have the feeling that the Command in the sense of gang of four is different than the Command in the sense of CQRS for example. Am I right ?
UPDATE:
What makes me confused here is that in terms of CQRS you can have a commands and events and lets supposed that third party system sends a message to my system CREATE_RESERVATION wouldn't this in the context of CQRS be a command and yet this is more of a complete workflow probably SAGA pattern ?
design-patterns architecture domain-driven-design cqrs command-pattern
Command is a transaction - it is either completed or failed. There is no third state. What you are describing looks like saga / process manager to me
– Roman Eremin
Nov 21 '18 at 11:03
You need a Saga. You can read this answer about how to initialize a Saga: softwareengineering.stackexchange.com/questions/381727/…
– Constantin Galbenu
Nov 21 '18 at 13:03
add a comment |
I have the folowing opertaion. I need to create a reservation, during the create of reservation I need to orchestrate several things. The reservation is ordered through a third party system, then an e-mail is sent , then a price offer is finalized and so on...
Can I encapuslate this logic in a single CreateReservationCommand or I need to have three commands and then what pattern would orchestrate the command execution ? Can a command has execution state at all ?
Also I have the feeling that the Command in the sense of gang of four is different than the Command in the sense of CQRS for example. Am I right ?
UPDATE:
What makes me confused here is that in terms of CQRS you can have a commands and events and lets supposed that third party system sends a message to my system CREATE_RESERVATION wouldn't this in the context of CQRS be a command and yet this is more of a complete workflow probably SAGA pattern ?
design-patterns architecture domain-driven-design cqrs command-pattern
I have the folowing opertaion. I need to create a reservation, during the create of reservation I need to orchestrate several things. The reservation is ordered through a third party system, then an e-mail is sent , then a price offer is finalized and so on...
Can I encapuslate this logic in a single CreateReservationCommand or I need to have three commands and then what pattern would orchestrate the command execution ? Can a command has execution state at all ?
Also I have the feeling that the Command in the sense of gang of four is different than the Command in the sense of CQRS for example. Am I right ?
UPDATE:
What makes me confused here is that in terms of CQRS you can have a commands and events and lets supposed that third party system sends a message to my system CREATE_RESERVATION wouldn't this in the context of CQRS be a command and yet this is more of a complete workflow probably SAGA pattern ?
design-patterns architecture domain-driven-design cqrs command-pattern
design-patterns architecture domain-driven-design cqrs command-pattern
edited Nov 29 '18 at 11:57
Alexandar Petrov
asked Nov 21 '18 at 10:42
Alexandar PetrovAlexandar Petrov
5,3101135
5,3101135
Command is a transaction - it is either completed or failed. There is no third state. What you are describing looks like saga / process manager to me
– Roman Eremin
Nov 21 '18 at 11:03
You need a Saga. You can read this answer about how to initialize a Saga: softwareengineering.stackexchange.com/questions/381727/…
– Constantin Galbenu
Nov 21 '18 at 13:03
add a comment |
Command is a transaction - it is either completed or failed. There is no third state. What you are describing looks like saga / process manager to me
– Roman Eremin
Nov 21 '18 at 11:03
You need a Saga. You can read this answer about how to initialize a Saga: softwareengineering.stackexchange.com/questions/381727/…
– Constantin Galbenu
Nov 21 '18 at 13:03
Command is a transaction - it is either completed or failed. There is no third state. What you are describing looks like saga / process manager to me
– Roman Eremin
Nov 21 '18 at 11:03
Command is a transaction - it is either completed or failed. There is no third state. What you are describing looks like saga / process manager to me
– Roman Eremin
Nov 21 '18 at 11:03
You need a Saga. You can read this answer about how to initialize a Saga: softwareengineering.stackexchange.com/questions/381727/…
– Constantin Galbenu
Nov 21 '18 at 13:03
You need a Saga. You can read this answer about how to initialize a Saga: softwareengineering.stackexchange.com/questions/381727/…
– Constantin Galbenu
Nov 21 '18 at 13:03
add a comment |
1 Answer
1
active
oldest
votes
Can I encapuslate this logic in a single CreateReservationCommand or I need to have three commands and then what pattern would orchestrate the command execution ? Can a command has execution state at all ?
You can... but usually the book keeping of orchestration uses something like the process manager pattern, which would span multiple transactions.
I have the feeling that the Command in the sense of gang of four is different than the Command in the sense of CQRS for example. Am I right ?
You are absolutely correct -- completely different ideas. "Command in CQRS" is a descendant of Gregor Hohpe's Command Message pattern.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53410326%2fcommand-pattern-how-to-preserve-execution-state%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Can I encapuslate this logic in a single CreateReservationCommand or I need to have three commands and then what pattern would orchestrate the command execution ? Can a command has execution state at all ?
You can... but usually the book keeping of orchestration uses something like the process manager pattern, which would span multiple transactions.
I have the feeling that the Command in the sense of gang of four is different than the Command in the sense of CQRS for example. Am I right ?
You are absolutely correct -- completely different ideas. "Command in CQRS" is a descendant of Gregor Hohpe's Command Message pattern.
add a comment |
Can I encapuslate this logic in a single CreateReservationCommand or I need to have three commands and then what pattern would orchestrate the command execution ? Can a command has execution state at all ?
You can... but usually the book keeping of orchestration uses something like the process manager pattern, which would span multiple transactions.
I have the feeling that the Command in the sense of gang of four is different than the Command in the sense of CQRS for example. Am I right ?
You are absolutely correct -- completely different ideas. "Command in CQRS" is a descendant of Gregor Hohpe's Command Message pattern.
add a comment |
Can I encapuslate this logic in a single CreateReservationCommand or I need to have three commands and then what pattern would orchestrate the command execution ? Can a command has execution state at all ?
You can... but usually the book keeping of orchestration uses something like the process manager pattern, which would span multiple transactions.
I have the feeling that the Command in the sense of gang of four is different than the Command in the sense of CQRS for example. Am I right ?
You are absolutely correct -- completely different ideas. "Command in CQRS" is a descendant of Gregor Hohpe's Command Message pattern.
Can I encapuslate this logic in a single CreateReservationCommand or I need to have three commands and then what pattern would orchestrate the command execution ? Can a command has execution state at all ?
You can... but usually the book keeping of orchestration uses something like the process manager pattern, which would span multiple transactions.
I have the feeling that the Command in the sense of gang of four is different than the Command in the sense of CQRS for example. Am I right ?
You are absolutely correct -- completely different ideas. "Command in CQRS" is a descendant of Gregor Hohpe's Command Message pattern.
answered Nov 21 '18 at 12:40
VoiceOfUnreasonVoiceOfUnreason
19.7k21847
19.7k21847
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53410326%2fcommand-pattern-how-to-preserve-execution-state%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Command is a transaction - it is either completed or failed. There is no third state. What you are describing looks like saga / process manager to me
– Roman Eremin
Nov 21 '18 at 11:03
You need a Saga. You can read this answer about how to initialize a Saga: softwareengineering.stackexchange.com/questions/381727/…
– Constantin Galbenu
Nov 21 '18 at 13:03