Questions tagged [queueable-interface]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
94
votes
0answers
3k views

When are the Queueable/Batchable penalties going to be enforced?

According to The New Apex Queueable Interface, from October 2014, we were told that chained Queueable calls would be exponentially delayed up to 64 seconds, chaining Batches would be exponentially ...
22
votes
2answers
4k views

Can we callout and chain a Queueable class?

I'll jump right into some code: public class ChainQueue implements Queueable, Database.AllowsCallouts { public void execute(QueueableContext context) { if(QueueUtil.hasNext()) { ...
21
votes
4answers
15k views

Can Queueable solve “Future method cannot be called from a future or batch method”?

I have code that must be called as @future as it requires all the resources one can get. The only problem is that in 1% of the cases this code is called from a Batch and therefore fails with System....
16
votes
1answer
6k views

System.AsyncException: Maximum stack depth has been reached

I have two Queueable classes, I am trying to execute them by chaining them. First approach was to calling second queueable from first class. But, it gives me "System.AsyncException: Maximum stack ...
14
votes
1answer
2k views

Can Queueable Apex Jobs Run in Parallel?

I've got a queueable Apex class that can create parent records for sources records passed into it. It maintains a map as it goes so that if two source records should relate to the same parent and it ...
13
votes
2answers
1k views

DML operation and async Queueable job - which executes first?

I have a trigger after insert on some arbitrary entity: trigger OpportunityTrigger on Opportunity (after insert) { // not bulkified for the sake of simplicity ID jobID = System.enqueueJob(...
11
votes
1answer
2k views

Governor Limits on System.enqueueJob in Asynchronous Apex – Documentation Wrong?

Is there any execution context which uses asynchronous governor limits and allows up to 50 jobs to be queued with System.enqueueJob in a single transaction, or is Salesforce’s documentation just wrong?...
11
votes
2answers
1k views

“Callout loop not allowed” in unit test for Queueable that implements HttpCalloutMock

I'm attempting to do a unit test for a Queueable that does an Http callout. When I run the test I get an exception: "System.CalloutException: Callout loop not allowed". Previously I was using @...
9
votes
1answer
564 views

Implement Domain Event Pattern in Apex - can and should it be done?

In Domain Driven Design a single pattern is drawing a lot of attention to itself - Domain Events and Event Queues. (slide via http://de.slideshare.net/andysal/never-mind-the-bollocks-heres-the-domain-...
8
votes
2answers
877 views

How to set an HttpCalloutMock to reply differently on subsequent requests to the same endpoint?

I'm building a Queueable that consumes an Azure service bus queue. Every call to the endpoint gives me one message so I keep on calling that same endpoint until I get a 204. The method that calls the ...
7
votes
2answers
10k views

Salesforce Queueable Interface Chaining LIMIT Error

I'm trying to chain queueable interfaces within apex class, but receiving this error when it gets executed: Too many queueable jobs added to the queue: 2 Here's a summary of the code: public ...
7
votes
2answers
2k views

System.AsyncException: Maximum callout depth has been reached

I have a System.Queuable job, on a particular Sandbox that is giving me issues. It works fine on other Orgs, but fails on this particular one. The job structure is this: Batch Apex job calls System....
7
votes
1answer
592 views

Chaining Callouts and Queueables

I have the following pseudo-code, and what I am attempting to do is chain queues that require call outs, I have read around and saw that you can't create another queue after a call out. I see the ...
7
votes
1answer
859 views

Test execution order issues with Queueable and @future method

Test code: * Test.startTest(); * System.enqueueJob(new MyJob()); * Test.stopTest(); * System.debug('Quering record for assertion'); Expected Queueable job execution: * Job Start * Query records * ...
7
votes
2answers
337 views

Throttling http callouts across queueables executed in parallel

I have a batch job which processes millions of records through an HTTP callout to a third-party API. The API doesn’t handle batching, so each record needs its own callout. It takes well over 24 hours ...
6
votes
1answer
1k views

Chaining in Queueable Job

Is chaining possible in Queueable Job? I have added 50 Queueable Job to the queue Integer N = 50; for (Integer i = 0; i < N; i++) { System.enqueueJob(new QueuableDemo1(i)); } Does above ...
6
votes
1answer
1k views

Testing Recursive Queueable Class

I have an Apex class that implements the Queueable interface which is used to remove custom objects attached to a set of Account Ids, and then inserts new custom objects to replace them. The volume ...
6
votes
1answer
1k views

Run Queueable Job in System Context?

The use case is a trigger calls(enqueues) a Queueable job. The code is failing and I did some debugging and figured out that it is running in user context. I thought asynchronous jobs run in system ...
6
votes
2answers
310 views

How to mix getContentAsPDF calls with DML?

This critical update: PageReference getContent() and getContentAsPDF() Methods Treated as Callouts will be auto-activated in January 2016. We have some code that uses a queue of custom event ...
6
votes
1answer
117 views

A callout pattern idea

I just came up with the following pattern for making callouts. It's loosely based on Dan Appleman's Scheduler pattern. Has anyone out there has used or dismissed this? Why did you dismiss it? ...
5
votes
3answers
368 views

Queuable Apex logic in Constructor or Execute Method

I have a chained queuable apex class making an HTTP request to an external server. After each request comes back with a successful response, the next class will fire and make another request to a ...
5
votes
2answers
472 views

Automated testing of chained Queueable jobs in Salesforce

I am currently writing a queueable class for asynchronous processing in my triggers since triggers do not allow callouts. I am going achieve it by calling a class which implements the queueable ...
5
votes
2answers
620 views

How can my code tell if it's inside a Queueable context?

To go with the new System.Queueable interface, I'm looking for the analogy of: System.isBatch() System.isFuture() System.isScheduled() Is there a System.isQueued() or something?
5
votes
1answer
271 views

How can I get around queued job limitations?

I'm writing a queueable class to perform some image optimizations. The class has to call out to AWS S3, get the source image, then call out to Kraken.io three times to optimize the source image, get a ...
5
votes
2answers
6k views

Call Queueable from future method

I have a use-case where I need to execute some logic in async mode and I found that using Queueable Interface I can achieve that. But when I am trying to the use the Queuable Interface, some issues ...
5
votes
1answer
668 views

Queueable class throws Uncommitted Work Pending error in one test, but not others [duplicate]

I noticed yesterday that one of my new test cases was failing, and determined from the logs that I was getting the beloved System.CalloutException: You have uncommitted work pending. Please commit or ...
5
votes
1answer
395 views

Design pattern for logging HTTP Callouts

I'm building an application that integrates with an external service. Two items on our list of requirements is: Log all Callouts to the external system in Salesforce Execute all Callouts in a ...
5
votes
1answer
81 views

Queueable logs don't have a completed date?

Working on writing a queueable and noticed that the completed date field under Apex Jobs is blank. Futures have this. Is the only way I can get a run time is to log it myself?
4
votes
2answers
702 views

When passing in a collection of sObjects to a Queueable what values are used?

Suppose I pass in a collection of sObjects to a queueable. Does the queueable execute on the values of the sobjects field that get passed when the queueable is invoked? Given it is possible for these ...
4
votes
3answers
1k views

How to set time limit between queued jobs?

So I am looking to implement Queueable jobs in apex to send 200 emails (1 job) every 30 minutes until all the jobs are done, I am struggling to find any documentation on how this functionality can be ...
4
votes
1answer
442 views

Enqueue Queueable class multiple times

I need to do five different callouts from my trigger. I'm planning to use one Queueable class for all the callout using the parameter passed in the constructor. I'm not sure if it is possible, if it ...
4
votes
2answers
327 views

Send out email when Apex Queueable fails and test it

This question definitely is a duplicate of many questions here, but after reading most of them I am still somewhat clueless. Question 1: why I can't just catch exceptions in the execute and send an ...
4
votes
1answer
279 views

Keep track of chained Queueable

I'd like to insert a lot of records. Chaining Queueable classes seems to be the way to go in my scenario, I am just wondering if the following is feasible: keep track of chained jobs - when first job ...
4
votes
0answers
417 views

Execute some code after all trigger batches complete?

Suppose I update 1000 records and I have an after update trigger. That trigger will run 5 times for each batch of 200. Is there any possible way to collect data over the course of the 5 executions and ...
3
votes
1answer
842 views

System.AsyncException: System.enqueueJob is not allowed in this context

I'm trying to call Queuable interface class from controller class and getting an Exception. Why? System.AsyncException: System.enqueueJob is not allowed in this context.
3
votes
1answer
171 views

Queueable interface invalid

I'm trying to deploy everything from my existing (and fully functional) development sandbox to a freshly created sandbox. One of my classes (JobQueueable) implements the Queueable-interface from ...
3
votes
1answer
491 views

Queueable DML capability

When using Queueable class for DML operation, what are the limits impose? Is it 10,000 dml rows and 50,000 rows retrieved from SOQL? In fact i was trying to implement the queuable interface in a ...
3
votes
1answer
101 views

Change Data Capture vs Queueable Apex

With the introduction of Change Data Capture, now there is one more way to execute Asynchronous Apex. What are the advantages of Change Data Capture over Queueable Apex? How Salesforce will enqueue ...
3
votes
1answer
2k views

Queueable vs Schedulable interface - job start time

This blog post - https://developer.salesforce.com/blogs/engineering/2014/10/new-apex-queueable-interface.html - suggests that Queueable should be used in place of Schedulable from now on to avoid ...
2
votes
1answer
748 views

I want to pass an HttpRequest object to a Class that implements the Queueable interface

This is similar to this question, but I'm wondering about the object I'm sending into the Queueable Class. Here's the Queuable Class (not much more than debug statements at this point) public class ...
2
votes
1answer
223 views

Is there a way to chain jobs indefinitely?

What I mean is that I want a way of running some kind of loop indefinitely. This loop is going to make a callout to an endpoint, and it needs to be fast (so it can't be scheduled to run 10 to 10 ...
2
votes
2answers
343 views

Queueable Apex consideratoins

This is more of a theoretical question and probably goes more to design and I hope I can do this justice. I have successfully coded in apex multiple triggers which make callouts using the @future (...
2
votes
2answers
3k views

Why salesforce has introduced Queueable Apex. need some proper clarification

future method behaviour - 1. is executed in their own thread 2. do not start untill resource are available 3. future callout gives us 200 asynchronous soql limit. Why we use Queueable Apex and in ...
2
votes
1answer
425 views

Difference between using System.Queueable and Queueable and where to use Database.AllowsCallouts

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 ...
2
votes
1answer
3k views

Apex Blob data chunking

I am able to upload the Blob data to the local web server. However, the I have run into the error "Exceeded max size limit of 12000000 with request size xxxxx" This means that the file size is ...
2
votes
1answer
375 views

Delay in Queueable job execution

I have a Queueable job en queued by a custom trigger and the Queueable job makes REST API call to an external system. When I monitor the job, it used to start processing in couple of minutes but in ...
2
votes
0answers
168 views

Post callout behavior assertions for unit test with static resource callout mock fail

I have a working queueable callout, and working tests using static resource callout mock I can successfuly run basic assertions on the mock response body and status. However, the callout method in ...
2
votes
0answers
2k views

ApexMock - Test method to invoke a Queueable method fails

I am using ApexMocks to write unit tests for a method that invokes a Queueable class. My test objective is to verify is the class has been invoked once via the trigger handler. Below is a sample code ...
2
votes
0answers
601 views

ConcurrentPerOrgApex Limit exceeded

We are calling Queueable Interface from trigger to make multiple callouts to external systems. The number of callout from Queueable class is 50 as the other system can process only one record at a ...
1
vote
1answer
2k views

Limit of Queueable Jobs Added to the Queue?

I have chained three queueable classes. Couple of them have callouts and other one is not callout. For both the callout classes execute method execution, "No of queueable jobs added to the queue" is ...