Git Product home page Git Product logo

Comments (2)

slashdotdash avatar slashdotdash commented on July 21, 2024 1

@fdbeirao No, I don't think so. Perhaps, yes! I need to read further into how correlation ids would work for process managers. In theory, it could be the case that a process manager is identified by the correlation id of the message (event) that created it.

In Commanded you would use a process manager to implement a saga. So I would say the identity returned from the process manager's interested?/1 function is the identity for the process manager (aka saga).

In the example below it is the transfer_uuid that uniquely identifies a single instance of the transfer money process manager:

defmodule TransferMoneyProcessManager do
  use Commanded.ProcessManagers.ProcessManager,
    name: "transfer_money_process_manager",
    router: BankRouter

  def interested?(%MoneyTransferRequested{transfer_uuid: transfer_uuid}), do: {:start, transfer_uuid}
  def interested?(%MoneyWithdrawn{transfer_uuid: transfer_uuid}), do: {:continue, transfer_uuid}
  def interested?(%MoneyDeposited{transfer_uuid: transfer_uuid}), do: {:stop, transfer_uuid}
  def interested?(_event), do: false

  # ...
end

from commanded.

fdbeirao avatar fdbeirao commented on July 21, 2024

Quick and maybe unrelated question. Do you see the correlationId as being semantically the same as a saga identifier, from Hector Garcia-Molina's paper "sagas":

The begin-saga command can return a saga identifier to the program. This identifier can then be passed to the system on subsequent calls made by the saga.

Or am I mixing up two concepts here?

from commanded.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.