Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- System.enqueueJob(new QueueableExampleOne());
- public void execute(QueueableContext context)
- {
- System.debug(System.LoggingLevel.ERROR,'From queueable example one');
- System.debug('This is from first queue');
- String strUsername='praveen';
- String strPwd='praveen';
- Http m_http = new Http();
- HttpRequest req = new HttpRequest();
- String content = 'username='+EncodingUtil.urlEncode(strUsername, 'UTF-8')+'&password='+EncodingUtil.urlEncode(strPwd, 'UTF-8')+'&listname='+EncodingUtil.urlEncode('PraveenKumarG', 'UTF-8');
- req.setEndpoint('http://xyz/BMEapp/API.asmx/listCreate');
- req.setHeader('Content-Type','application/x-www-form-urlencoded');
- req.setMethod('POST');
- req.setBody(content);
- httpResponse response = m_http.send(req);
- System.debug('2nd callout response=='+response.getBody());
- System.enqueueJob(new QueuableExampleTwo());
- }
- public class QueuableExampleTwo implements Queueable, Database.AllowsCallouts{
- public void execute(QueueableContext ctxt){
- System.debug('This is from second queue');
- System.debug(System.LoggingLevel.ERROR,'From QueueableContext example two');
- System.enqueueJob(new QueuableExampleThree());
- }
- @future(callout =true)
- public static void testexecute()
- {
- String strUsername='praveen';
- String strPwd='praveen';
- Http m_http = new Http();
- HttpRequest req = new HttpRequest();
- String content = 'username='+EncodingUtil.urlEncode(strUsername, 'UTF-8')+'&password='+EncodingUtil.urlEncode(strPwd, 'UTF-8')+'&listname='+EncodingUtil.urlEncode('PraveenKumarG', 'UTF-8');
- req.setEndpoint('http://xyz/BMEapp/API.asmx/listCreate');
- req.setHeader('Content-Type','application/x-www-form-urlencoded');
- req.setMethod('POST');
- req.setBody(content);
- httpResponse response = m_http.send(req);
- System.debug(response.getBody());
- }}
- public void execute(QueueableContext ctxt){
- System.debug('This is from third queue');
- System.debug(System.LoggingLevel.ERROR,'From QueueableContext example two');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement