So as you do not know the max retry here you have two options
- use Orchestrator api request to get the queue definition and from that you get the max retry for queue /odata/QueueDefinitions
- Store it in asset because only when you create a queue you can set the value so if you are changing change the asset and read it
Now from transactionitem.ReteyNo you will get the current retry number compare it with the max to know if it is the final transaction or if it would be retried
Hope this helps.Let me know if you have any issues
cheers