There does not appear to be any way to get the message id of the message generated by Cloverleaf (which holds the contents of a row returned by the Inbound protocol query), not in the Read Success action anyway.
From the documentation it appears that there is no message or column value available to the Read Success activity/query. The examples are based on the use of a flag, basically, that you can use some column with a fixed/expected value to select your data (flag = Y), and then in your Read Success action, you set that flag = N where that flag = Y, and that you believe that no rows have had that column set to Y in the time between the Read and the Read Success.
You could have a more complex stored procedure that first selects all the eligible rows, marks them (or moves them to a special ‘in-progress’ table), and then returns those rows to the protocol. The Read success must assume that all marked rows are now eligible for completion (whatever that means to you). This at least guarantees that rows are only processed once. But if there is a Read Failure, then the Read Failure stor proc must restore the previous state, and it must assume that ALL rows in the ‘in-progress’ state are eligible for restore.
I have not had a chance to play with the new global variables. But even if a global variable can be used in a Read and Read Success query, there is no TCL UPOC that allows you to increment it, once it is used.
The new version of Cloverleaf introduced variables into some of the other protocols (Fileset-Local, etc.) that would automatically include things like a date stamp or other context value into an output filename. Something similar for the database inbound protocol would solve this problem once and for all. Example: provide a new field that contains tcl, or even just a simple incrementtng variable. You can then guarantee that you provide a unique value in your query that can be used to mark rows, and, assuming that your Read Success query has access to this same variable (before it is changed), it can be used to ‘complete’ or delete the processed rows.
There are other methods that could be used, but require changes to Cloverleaf, all of which basically provide a way for a unique value to be used in both the Read and the Read Success actions, and also provide a way to increment/change it, once the transactions are processed.