cancel
Showing results for 
Search instead for 
Did you mean: 

Web-script transactions

msvoren
Champ in-the-making
Champ in-the-making
Hi!

Is it possible to configure transactions within 1 webscript?
The way it works now: webscript creates a node. That node is commited to repository (when running of web-script is completed) and you can not use that node with another process until web-script transaction completes.

Is it possible to confugure script to have 2 or more transactions, like this:
<webscript>
    transaction 1:
        - create node

    transaction 2:
         - do something with node (which is already phisically saved on repository)
</webscript>


Thanks!
4 REPLIES 4

mrogers
Star Contributor
Star Contributor
Step back a little, why can't you "do something" with your "created node".  How did "do something" get out of the current transaction scope?

But if you do need to run two separate transactions within a web script then one option is to have the script implemented in Java and use the Transaction Service.

Another approach may be to queue an action for your new node.  The action queue will run after your first transaction commits.

msvoren
Champ in-the-making
Champ in-the-making
Thank you for your reply.

"Do something" got out of the current transaction scope because i'm sending nodeRef of that created node to application outside alfresco, and, at a time of running alfresco webscript, application can not see that node yet.

Can you please explain "queue an action" concept in more detail?

Thanks!

mrogers
Star Contributor
Star Contributor
You can write an action executer to call your external process outside alfresco, and call it either through a rule or by using the Java or Java Script APIs of the action service.  You will find your action executer does have access to the new node ref (since it runs post-commit) and therefore your external app can access the new node ref.

Failing that you will need to use the Transaction Service and start separate transactions.

msvoren
Champ in-the-making
Champ in-the-making
Thank you for your answer, will see what can be done here.
:idea: