2

I was trying out the superbadge of Data Integration specialist and implemented the inner class QueueablePMSCall as expected. The class was declared as:

private class QueueablePMSCall implements Queueable{
//code inside
}

However, I received error that "Could not find an inner class named 'QueueablePMSCall' that implements System.Queueable and Database.AllowsCallouts."

I have 2 queries here:

  1. The issue resolved when I used System.Queueable instead of Queueable. Is this due to trailhead engines's testing code. Also, which is advisable to be used?
  2. Why is Database.AllowsCallouts required to be implemented for queueable apex? Please provide any documentation mentioning use of this interface other than in Batch Apex.
  • 1. Interface queueable is part of namespace system. Both conventiond are fine. 2. Allow callouts should be used if you want to perform callouts to external system. If not -- that is not required – kurunve Dec 19 '17 at 11:38
3
  1. The issue resolved when I used System.Queueable instead of Queueable. Is this due to trailhead engines's testing code. Also, which is advisable to be used?

It is easier to not include the System namespace when calling static methods of system classes, but there are situations where you must include the System namespace to differentiate the built-in Apex classes from custom Apex classes with the same name. If your organization contains Apex classes that you’ve defined with the same name as a built-in class, the Apex runtime defaults to your custom class and calls the methods in your class

Ref : Using the System Namespace

  1. Why is Database.AllowsCallouts required to be implemented for queueable apex? Please provide any documentation mentioning use of this interface other than in Batch Apex.

If you are making callout then only DataBase.AllowCalloutsis required otherwise I don't think there is any need to use that interface.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.