Wednesday 7 January 2015

Is Self Chaining possible in Queueable Interface? - Part 2

With reference to previous #MySfdcTweets on #QueueableInterface self-chaining possibility, I encounter this error:

System.AsyncException: Maximum callout depth has been reached.

Salesforce documents says, "Maximum stack depth is two, which means you can add only one job from an executing job", which I think I am abiding by literally.

The reason in my case seems to be this:

I get this AsyncException because of recursive chaining like Job A --> Job A --> Job A.

So let me put this into a better perspective: ;)

Maximum stack depth should mean that there could be maximum two sequential jobs(Job A ---> Job B, not Job A --> Job B --> Job C and so on.) in a Queueable context.

I even tried putting some static flag to prevent recursion so as to maintain stack depth to 2. It too didn't work. :P  It feels that the static variable somehow getting lost in the asynchronous context. :D

However, it should be better to get this understanding verified by SFDC Technical Expert Team.

...To Be Continued  (Y)


My experience(twist and turns) with Queueable Interface implementation reminds me of this beautiful song.  Twist and turns by James Spencer

Listening to and feeling invigorated..

No comments:

Post a Comment

Thank you for visiting. Your comments are highly appreciated.