Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Comprehension question: clientside customOperation request and resulting serverside RPCManager transaction behavior

    Hi Isomorphic,

    I have a simple comprehension question: If a server DMI receives a single operationType="custom"-request, what is the default behavior w.r.t to RPCManager-TransactionPolicy and these docs?
    Is a operationType="custom" always treated as change-operation in TransactionPolicy.ANY_CHANGE, so will there be a transaction from the start of the DMI?
    Will new DSRequest()s using the rpcManager from incomingRequest.getRPCManager() always be part of a transaction?

    Background: I have a operationType="custom"-request doing some aggregation (merging entries together). If there in some late step something goes wrong, I want all changes to be rolled back on return new DSResponse().setFailure().

    Thank you & Best regards
    Blama

    #2
    Hi Isomorphic,

    can you answer this one?
    It's pretty clear of the normal CRUD operations CUD are change-operations and that R is not.
    The file-operations can't be in a transaction, as they act on the file system and not the database.
    Basically all other operations defined as OP_-constants in DataSource are not change-operations.
    Only thing unclear to me is OP_CUSTOM, where the docs here or in TransactionPolicy-related docs don't say anything.

    Best regards
    Blama

    Comment


      #3
      Custom operations are not assumed to be modification operations on the associated data store, as they could represent absolutely anything - sending an email, etc. So if your queue leads with such an operation you would need to set TransactionPolicy.ALL if you want a transaction started.

      Having done this, if you wanted to have data store operations initiated in a custom operation become part of the transaction, you can simply setRPCManager() on them.

      If you want something that goes wrong in a custom operation to cause the transaction to fail and roll back, setting failure isn't enough (as it would not be for, eg, a fetch), you would need to manually do this, eg skipRemainingRequests() and telling the DSTransaction to rollback().

      Comment


        #4
        Hi Isomorphic,

        I just noticed that you cover this now in the docs, thanks.

        Best regards
        Blama

        Comment

        Working...
        X