Asynchronous Messaging as a Service
Message – This module provides APIs for messages, i.e., sending, pulling and removing messages from a particular queue. Asynchronous messages can be sent to a queue that can be pulled.
Queue – Manage asynchronous queues, along with creating queues it provides operations to create, delete, purge messages, view pending messages and get all messages in a specific queue.
import com.shephertz.app42.paas.sdk.android.App42API; import com.shephertz.app42.paas.sdk.android.App42Response; import com.shephertz.app42.paas.sdk.android.App42Exception; import com.shephertz.app42.paas.sdk.android.App42BadParameterException; import com.shephertz.app42.paas.sdk.android.App42NotFoundException; import com.shephertz.app42.paas.sdk.android.message.Queue; import com.shephertz.app42.paas.sdk.android.message.QueueService;using com.shephertz.app42.paas.sdk.windows; using com.shephertz.app42.paas.sdk.windows.message;#import "Shephertz_App42_iOS_API/Shephertz_App42_iOS_API.h"#import<Shephertz_App42_iOS_API/Shephertz_App42_iOS_API.h>import com.shephertz.app42.paas.sdk.java.App42API; import com.shephertz.app42.paas.sdk.java.App42Response; import com.shephertz.app42.paas.sdk.java.App42Exception; import com.shephertz.app42.paas.sdk.java.App42BadParameterException; import com.shephertz.app42.paas.sdk.java.App42NotFoundException; import com.shephertz.app42.paas.sdk.java.message.Queue; import com.shephertz.app42.paas.sdk.java.message.QueueService;using com.shephertz.app42.paas.sdk.csharp; using com.shephertz.app42.paas.sdk.csharp.message;Not AvailableComing SoonComing Soonusing com.shephertz.app42.paas.sdk.csharp; using com.shephertz.app42.paas.sdk.csharp.message;include_once '../QueueService.php'; include_once '../App42Log.php'; include_once '../App42Response.php'; include_once '../App42Exception.php'; include_once '../App42BadParameterException.php'; include_once '../App42NotFoundException.php';Coming Soonrequire 'App42_Ruby_API'import com.shephertz.app42.paas.sdk.as3.App42API; import com.shephertz.app42.paas.sdk.as3.App42Response; import com.shephertz.app42.paas.sdk.as3.App42Exception; import com.shephertz.app42.paas.sdk.as3.App42BadParameterException; import com.shephertz.app42.paas.sdk.as3.App42NotFoundException; import com.shephertz.app42.paas.sdk.as3.message.Message; import com.shephertz.app42.paas.sdk.as3.message.Queue; import com.shephertz.app42.paas.sdk.as3.message.QueueService;Coming Soonimport com.shephertz.app42.paas.sdk.jme.App42API; import com.shephertz.app42.paas.sdk.jme.App42Response; import com.shephertz.app42.paas.sdk.jme.App42Exception; import com.shephertz.app42.paas.sdk.jme.App42BadParameterException; import com.shephertz.app42.paas.sdk.jme.App42NotFoundException; import com.shephertz.app42.paas.sdk.jme.message.Queue; import com.shephertz.app42.paas.sdk.jme.message.QueueService;
In order to use the various functions available in a specific API, the developer has to initialize with App42API by passing the apiKey and the secretKey which will become available after the app creation from AppHQ dashboard.
Required Parameters
apiKey - The Application key given when the application was created.
secretKey - The secret key corresponding to the application key given when the application was created.
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");App42API.Initialize("API_KEY","SECRET_KEY");[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")App42API.initialize("API_KEY","SECRET_KEY");App42API.Initialize("API_KEY","SECRET_KEY");Not AvailableApp42API:initialize("API_KEY","SECRET_KEY");App42API::Initialize("API_KEY", "SECRET_KEY");App42API.Initialize("API_KEY","SECRET_KEY");App42API::initialize("API_KEY","SECRET_KEY");App42API::Initialize("API_KEY", "SECRET_KEY");api = App42::ServiceAPI.new("API_KEY","SECRET_KEY")App42API.initialize("API_KEY","SECRET_KEY");Coming SoonApp42API.initialize("API_KEY","SECRET_KEY");
After initialization, the developer will have to call the buildXXXService method on App42API to get the instance of the particular API that they wish to build. For example, to build an instance of Queue Service, buildQueueService() method needs to be called.
QueueService queueService = App42API.buildQueueService();QueueService queueService = App42API.BuildQueueService();QueueService *queueService = [App42API buildQueueService];let queueService = App42API.buildQueueService() as? QueueServiceQueueService queueService = App42API.buildQueueService();QueueService queueService = App42API.BuildQueueService();Not AvailableComing SoonComing SoonQueueService queueService = App42API.BuildQueueService();$queueService = App42API::buildQueueService();Coming Soonqueue_service = api.build_queue_service()var queueService:QueueService = App42API.buildQueueService(); var message:QueueService = App42API.buildQueueService();Coming SoonQueueService queueService = App42API.buildQueueService();
Create a type pull queue.
Required Parameters
queueName - The name of the queue which has to be created.
queueDescription - Description of the queue.
String queueName = "MyQueue"; String queueDescription = "Description about the queue"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); queueService.createPullQueue(queueName, queueDescription, new App42CallBack() { public void onSuccess(Object response) { Queue queue = (Queue)response; System.out.println ("queueName is "+ queue.getQueueName () ); System.out.println ("queueType is "+ queue.getQueueType () ); System.out.println ("queueDescription is "+ queue.getDescription() ); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String queueName = "MyQueue"; String queueDescription = "Description about the queue."; App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); queueService.CreatePullQueue(queueName, queueDescription,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Queue queue = (Queue) response; Console.WriteLine("queueName is "+ queue.GetQueueName()); Console.WriteLine("queueType is "+ queue.GetQueueType()); Console.WriteLine("queueDescription is "+ queue.GetDescription()); String jsonResponse = queue.ToString(); } }NSString *queueName = @"MyQueue"; NSString *queueDescription = @"Description about the queue."; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; QueueService *queueService = [App42API buildQueueService]; [queueService createPullQueue:queueName description:queueDescription completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Queue *queue = (Queue*)responseObj; NSLog(@"Queue Name is %@" , queue.queueName); NSLog(@"Description is %d" , queue.description); } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let queueService = App42API.buildQueueService() as? QueueService let queueName = "MyQueue" let queueDescription = "Description about the queue." queueService?.createPullQueue(queueName, description: queueDescription, completionBlock:{ (success, response, exception) -> Void in if(success) { let queue = response as! Queue NSLog("Response=%@",queue.strResponse); NSLog("Description=%@",queue.description); for message in queue.messageArray { NSLog("CorrelationId is =%@",message.correlationId) NSLog("MessageId is =%@",message.messageId) NSLog("Payload is = %@",message.payLoad) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) } })String queueName = "MyQueue"; String queueDescription = "Description about the queue."; App42.initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); Queue queue = queueService.createPullQueue(queueName, queueDescription); System.out.println ("queueName is "+ queue.getQueueName () ); System.out.println ("queueType is "+ queue.getQueueType () ); System.out.println ("queueDescription is "+ queue.getDescription() ); String jsonResponse = queue.toString();String queueName = "MyQueue"; String queueDescription = "Description about the queue."; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); queueService.CreatePullQueue(queueName, queueDescription,new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Queue queue = (Queue) response; App42Log.Console("QueueName :" + queue.GetQueueName()); App42Log.Console("QueueType :" + queue.GetQueueType()); App42Log.Console("Queue Description : "+ queue.GetDescription()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing SoonComing SoonString queueName = "MyQueue"; String queueDescription = "Description about the queue."; App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); Queue queue = queueService.CreatePullQueue(queueName, queueDescription); Console.WriteLine("Queue Name is : "+ queue.GetQueueName()); Console.WriteLine("Queue Type is : "+ queue.GetQueueType()); Console.WriteLine("Queue Description : "+ queue.GetDescription()); String jsonResponse = queue.toString();$queueName = "MyQueue"; $queueDescription = "Description about the queue."; App42API::initialize("API_KEY","SECRET_KEY"); $queueService = App42API::buildQueueService(); $queue = $queueService->createPullQueue($queueName, $queueDescription); print_r("queueName is" . $queue->getQueueName()); print_r("queueType is" . $queue->getQueueType()); print_r("queueDescription is " .$queue->getDescription()); $jsonResponse = $queue->toString();Coming Soonqueue_name = "MyQueue"; queue_description = "Description about the queue."; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") queue_service = api.build_queue_service() queue = queue_service.create_pull_queue(queue_name, queue_description); puts "queueName is #{queue.queue_name}"; puts "queueType is #{queue.queue_type}" ; puts "queueDescription is #{queue.queue_description}"; json_response = queue.to_s();var queueName:String = "MyQueue"; var queueDescription:String = "Description about the queue."; App42API.initialize("API_KEY","SECRET_KEY"); var queueService:QueueService = App42API.buildQueueService(); var message:QueueService = App42API.buildQueueService(); queueService.createPullQueue(queueName, queueDescription,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var queue1:Queue = Queue(response); trace("Queue Name is : " + queue1.getQueueName()); trace("Queue Type is : " + queue1.getQueueType()); trace("Description is : " + queue1.getDescription()); } }Coming SoonString queueName = "MyQueue"; String queueDescription = "Description about the queue."; App42API.initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); Queue queue = queueService.createPullQueue(queueName, queueDescription); System.out.println("queueName is "+ queue.getQueueName()); System.out.println("queueType is "+ queue.getQueueType()); System.out.println("queueDescription is "+ queue.getDescription()); String jsonResponse = queue.toString();
Purge message on the queue.
Note: Once the queue is purged, the messages are removed from the queue and won’t be available for dequeuing.
Required Parameters
queueName - The name of the queue which has to be purged.
String queueName = "MyQueue"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); queueService.purgePullQueue(queueName, new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("response is " + app42response) ; } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String queueName = "MyQueue"; App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); queueService.PurgePullQueue(queueName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { App42Response app42Response = (App42Response)response; Console.WriteLine("App42Response is : "+ app42Response); String jsonResponse = app42Response.ToString(); } }NSString *queueName = @"MyQueue"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; QueueService *queueService = [App42API buildQueueService]; [queueService purgePullQueue:queueName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { App42Response *response = (App42Response*)responseObj; NSString *success = response.isResponseSuccess; NSString *jsonResponse = [response toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let queueService = App42API.buildQueueService() as? QueueService let queueName = "MyQueue" queueService?.purgePullQueue(queueName, completionBlock:{ (success, response, exception) -> Void in if(success) { let app42Response = response as! App42Response NSLog("Response=%@",app42Response.strResponse); } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) } })String queueName = "MyQueue"; App42.initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); App42Response app42response = queueService.purgePullQueue(queueName); boolean success = app42response.isResponseSuccess(); System.out.println("response is " + app42response) ; String jsonResponse = app42response.toString();String queueName = "MyQueue"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); queueService.PurgePullQueue(queueName,new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42Response = (App42Response)response; App42Log.Console("App42Response is :" + app42Response.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing SoonComing SoonString queueName = "MyQueue"; App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); App42Response app42Response = queueService.PurgePullQueue(queueName); Console.WriteLine("App42Response is : "+ app42Response); Boolean success = app42Response.IsResponseSuccess(); String jsonResponse = app42Response.ToString();$queueName = "MyQueue"; App42API::initialize("API_KEY","SECRET_KEY"); $queueService = App42API::buildQueueService(); $response = $queueService->purgePullQueue($queueName); print_r("Response is : ".$response->toString()); $success = $response->isResponseSuccess(); $jsonResponse = $response->toString();Coming Soonqueue_name = "MyQueue"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") queue_service = api.build_queue_service() response = queue_service.purge_pull_queue(queue_name); success = response.is_response_success(); json_response = response.to_s();var queueName:String = "MyQueue"; App42API.initialize("API_KEY","SECRET_KEY"); var queueService:QueueService = App42API.buildQueueService(); var message:QueueService = App42API.buildQueueService(); queueService.purgePullQueue(queueName,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var queue1:Queue = Queue(response); trace("Queue Name is : " + queue1.getQueueName()); trace("Description is : " + queue1.getDescription()); } }Coming SoonString queueName = "MyQueue"; App42API.initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); App42Response app42response = queueService.purgePullQueue(queueName); boolean success = app42response.isResponseSuccess(); System.out.println("response is " + app42response); String jsonResponse = app42response.toString();
Messages which are pending to be dequeued.
Note: Calling this method does not dequeue the messages in the Queue. The messages stay in the Queue till they are dequeued.
Required Parameters
queueName - The name of the queue from which pending messages have to be fetched.
String queueName = "MyQueue"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); queueService.pendingMessages(queueName, new App42CallBack() { public void onSuccess(Object response) { Queue queue = (Queue)response; System.out.println("queueName is " + queue.getQueueName()); System.out.println("queueType is " + queue.getQueueType()); ArrayList<Queue.Message> messageList = queue.getMessageList(); for(Queue.Message message : messageList) { System.out.println("correlationId is " + message.getCorrelationId()); System.out.println("messageId is " + message.getMessageId()); System.out.println("payLoad is " + message.getPayLoad()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String queueName = "MyQueue"; App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); queueService.PendingMessages(queueName, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Queue queue = (Queue) response; Console.WriteLine("QueueName is : "+ queue.GetQueueName()); Console.WriteLine("QueueType is : "+ queue.GetQueueType()); Console.WriteLine("QueueDescription is : "+ queue.GetDescription()); IList<Queue.Message> messageList = queue.GetMessageList(); for(int i = 0; i<messageList.Count; i++) { Console.WriteLine("CorrelationId is : " + messageList[i].GetCorrelationId()); Console.WriteLine("MessageId is : " + messageList[i].GetMessageId()); Console.WriteLine("PayLoad is : " + messageList[i].GetPayLoad()); } String jsonResponse = queue.ToString(); } }NSString *queueName = @"MyQueue"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; QueueService *queueService = [App42API buildQueueService]; [queueService pendingMessages:queueName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Queue *queue = (Queue*)responseObj; NSLog(@"Response is %@" , queue.strResponse); NSLog(@"isResponseSuccess is %d" , queue.isResponseSuccess); for (Message *message in queue.messageArray) { NSLog(@"CorrelationId is =%@", message.correlationId); NSLog(@"MessageId is = %@", message.messageId); NSLog(@"Payload is = %@", message.payLoad); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let queueService = App42API.buildQueueService() as? QueueService let queueName = "MyQueue" queueService?.pendingMessages(queueName, completionBlock:{ (success, response, exception) -> Void in if(success) { let queue = response as! Queue NSLog("Response=%@",queue.strResponse); for message in queue.messageArray { NSLog("CorrelationId is =%@",message.correlationId) NSLog("MessageId is =%@",message.messageId) NSLog("Payload is = %@",message.payLoad) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) } })String queueName = "MyQueue"; App42.initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); Queue queue = queueService.pendingMessages(queueName); System.out.println("queueName is " + queue.getQueueName()); System.out.println("queueType is " + queue.getQueueType()); ArrayList<Queue.Message> messageList = queue.getMessageList(); for(Queue.Message message : messageList) { System.out.println("correlationId is " + message.getCorrelationId()); System.out.println("messageId is " + message.getMessageId()); System.out.println("payLoad is " + message.getPayLoad()); } String jsonResponse = queue.toString();String queueName = "MyQueue"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); queueService.PendingMessages(queueName,new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Queue queue = (Queue) response; App42Log.Console("QueueName :" + queue.GetQueueName()); App42Log.Console("QueueType :" + queue.GetQueueType()); IList<Queue.Message> messageList = queue.GetMessageList(); for(int i = 0; i<messageList.Count; i++) { App42Log.Console("CorrelationId : " + messageList[i].GetCorrelationId()); App42Log.Console("MessageId : " + messageList[i].GetMessageId()); App42Log.Console("PayLoad : " + messageList[i].GetPayLoad()); } App42Log.Console("JsonResponse :" + queue.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing SoonComing SoonString queueName = "MyQueue"; App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); Queue queue = queueService.PendingMessages(queueName); Console.WriteLine("QueueName : "+ queue.GetQueueName()); Console.WriteLine("QueueType : "+ queue.GetQueueType()); IList<Queue.Message> messageList = queue.GetMessageList(); for(int i = 0; i<messageList.Count; i++) { Console.WriteLine("CorrelationId : " + messageList[i].GetCorrelationId()); Console.WriteLine("MessageId : " + messageList[i].GetMessageId()); Console.WriteLine("PayLoad : " + messageList[i].GetPayLoad()); } String jsonResponse = queue.ToString();$queueName = "MyQueue"; App42API::initialize("API_KEY","SECRET_KEY"); $queueService = App42API::buildQueueService(); $queue = $queueService->pendingMessages($queueName); print_r("queueName is " . $queue->getQueueName().PHP_EOL); print_r("queueType is " . $queue->getQueueType().PHP_EOL); $message = $queue->getMessageList(); foreach($message as $messageList) { print_r("correlationId is " .$messageList->getCorrelationId().PHP_EOL); print_r("messageId is " .$messageList->getMessageId().PHP_EOL); print_r("payLoad is " .$messageList->getPayLoad().PHP_EOL); } $jsonResponse = $queue->toString();Coming Soonqueue_name = "MyQueue"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") queue_service = api.build_queue_service() queue = queue_service.pending_messages(queue_name); puts "queueName is #{queue.queue_name}"; puts "queueType is #{queue.queue_type}"; message_list = Array.new(); message_list = queue.message_list(); for message in message_list do puts "correlationId is #{message.correlation_id}"; puts "messageId is #{message.message_id}"; puts "payLoad is #{message.pay_load}"; end json_response = queue.to_s();var queueName:String = "MyQueue"; App42API.initialize("API_KEY","SECRET_KEY"); var queueService:QueueService = App42API.buildQueueService(); var message:QueueService = App42API.buildQueueService(); queueService.pendingMessages(queueName,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var queue1:Queue = Queue(response); trace("Queue Name is : " + queue1.getQueueName()); trace("Queue Type is : " + queue1.getQueueType()); if(queue1.getMessageList().length > 0) { for(var j:int=0;j<queue1.getMessageList().length;j++) { trace("Correlation id is : " + Message(queue1.getMessageList()[j]).getCorrelationId()); trace("Message is " + Message(queue1.getMessageList()[j]).getMessageId()); trace("PayLoad is " + Message(queue1.getMessageList()[j]).getPayLoad()); } } } }Coming SoonString queueName = "MyQueue"; App42API.initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); Queue queue = queueService.pendingMessages(queueName); System.out.println("queueName is "+ queue.getQueueName()); System.out.println("queueType is "+ queue.getQueueType()); Vector messageList = queue.getMessageList(); for(int i = 0; i < messageList.size(); i++) { System.out.println("correlationId is " + ((Queue.Message)messageList.elementAt(i)).getCorrelationId()); System.out.println("messageId is " + ((Queue.Message)messageList.elementAt(i)).getMessageId()); System.out.println("payLoad is " + ((Queue.Message)messageList.elementAt(i)).getPayLoad()); } String jsonResponse = queue.toString();
Messages are retrieved and dequeued from the Queue.
Required Parameters
queueName - The name of the queue which have to be retrieved.
receiveTimeOut - Receive timed out (in milliseconds).
String queueName = "MyQueue"; long receiveTimeOut = 10000; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); queueService.getMessages(queueName, receiveTimeOut, new App42CallBack() { public void onSuccess(Object response) { Queue queue = (Queue)response; System.out.println("queueName is " + queue.getQueueName()); System.out.println("queueType is " + queue.getQueueType()); ArrayList<Queue.Message> messageList = queue.getMessageList(); for(Queue.Message message : messageList) { System.out.println("correlationId is " + message.getCorrelationId()); System.out.println("messageId is " + message.getMessageId()); System.out.println("payLoad is " + message.getPayLoad()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String queueName = "MyQueue"; long receiveTimeOut = 10000; App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); queueService.GetMessages(queueName, receiveTimeOut,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Queue queue = (Queue) response; Console.WriteLine("QueueName is : "+ queue.GetQueueName()); Console.WriteLine("QueueType is : "+ queue.GetQueueType()); Console.WriteLine("QueueDescription is : "+ queue.GetDescription()); IList<Queue.Message> messageList = queue.GetMessageList(); for(int i = 0; i<messageList.Count; i++) { Console.WriteLine("CorrelationId is : " + messageList[i].GetCorrelationId()); Console.WriteLine("MessageId is : " + messageList[i].GetMessageId()); Console.WriteLine("PayLoad is : " + messageList[i].GetPayLoad()); } String jsonResponse = queue.ToString(); } }NSString *queueName = @"MyQueue"; long receiveTimeOut = 10000; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; QueueService *queueService = [App42API buildQueueService]; [queueService getMessages:queueName receiveTimeOut:receiveTimeOut completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Queue *queue = (Queue*)responseObj; NSLog(@"Response is %@" , queue.strResponse); NSLog(@"isResponseSuccess is %d" , queue.isResponseSuccess); for (Message *message in queue.messageArray) { NSLog(@"CorrelationId is =%@", message.correlationId); NSLog(@"MessageId is = %@", message.messageId); NSLog(@"Payload is = %@", message.payLoad); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let queueService = App42API.buildQueueService() as? QueueService let queueName = "MyQueue" let timeOut = 10 queueService?.getMessages(queueName, receiveTimeOut: timeOut, completionBlock:{ (success, response, exception) -> Void in if(success) { let queue = response as! Queue NSLog("Response=%@",queue.strResponse); for message in queue.messageArray { NSLog("CorrelationId is =%@",message.correlationId) NSLog("MessageId is =%@",message.messageId) NSLog("Payload is = %@",message.payLoad) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) } })String queueName = "MyQueue"; long receiveTimeOut = 10000; App42.initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); Queue queue = queueService.getMessages(queueName, receiveTimeOut); System.out.println("queueName is " + queue.getQueueName()); System.out.println("queueType is " + queue.getQueueType()); ArrayList<Queue.Message> messageList = queue.getMessageList(); for(Queue.Message message : messageList) { System.out.println("correlationId is " + message.getCorrelationId()); System.out.println("messageId is " + message.getMessageId()); System.out.println("payLoad is " + message.getPayLoad()); } String jsonResponse = queue.toString();String queueName = "MyQueue"; long receiveTimeOut = 10000; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); queueService.GetMessages(queueName, receiveTimeOut,new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Queue queue = (Queue) response; App42Log.Console("QueueName :" + queue.GetQueueName()); App42Log.Console("QueueType :" + queue.GetQueueType()); IList<Queue.Message> messageList = queue.GetMessageList(); for(int i = 0; i<messageList.Count; i++) { App42Log.Console("CorrelationId : " + messageList[i].GetCorrelationId()); App42Log.Console("MessageId : " + messageList[i].GetMessageId()); App42Log.Console("PayLoad : " + messageList[i].GetPayLoad()); } App42Log.Console("JsonResponse :" + queue.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing SoonComing SoonString queueName = "MyQueue"; long receiveTimeOut = 10000; App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); Queue queue = queueService.GetMessages(queueName, receiveTimeOut); Console.WriteLine("QueueName : "+ queue.GetQueueName()); Console.WriteLine("QueueType : "+ queue.GetQueueType()); IList<Queue.Message> messageList = queue.GetMessageList(); for(int i = 0; i<messageList.Count; i++) { Console.WriteLine("CorrelationId : " + messageList[i].GetCorrelationId()); Console.WriteLine("MessageId : " + messageList[i].GetMessageId()); Console.WriteLine("PayLoad : " + messageList[i].GetPayLoad()); } String jsonResponse = queue.ToString();$queueName = "MyQueue"; $receiveTimeOut = 10000; App42API::initialize("API_KEY","SECRET_KEY"); $queueService = App42API::buildQueueService(); $queue = $queueService->getMessages($queueName, $receiveTimeOut); print_r("queueName is " . $queue->getQueueName().PHP_EOL); print_r("queueType is " . $queue->getQueueType().PHP_EOL); $message = $queue->getMessageList(); foreach($message as $messageList) { print_r("correlationId is " .$messageList->getCorrelationId().PHP_EOL); print_r("messageId is " .$messageList->getMessageId().PHP_EOL); print_r("payLoad is " .$messageList->getPayLoad().PHP_EOL); } $jsonResponse = $queue->toString();Coming Soonqueue_name = "MyQueue"; receive_time_out = 10000; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") queue_service = api.build_queue_service() queue = queue_service.get_messages(queue_name, receive_time_out); puts "queueName is #{queue.queue_name}"; puts "queueType is #{queue.queue_type}"; message_list = Array.new(); message_list = queue.message_list(); for message in message_list do puts "correlationId is #{message.correlation_id}"; puts "messageId is #{message.message_id}"; puts "payLoad is #{message.pay_load}"; end json_response = queue.to_s();var queueName:String = "MyQueue"; var receiveTimeOut:int = 10000; App42API.initialize("API_KEY","SECRET_KEY"); var queueService:QueueService = App42API.buildQueueService(); var message:QueueService = App42API.buildQueueService(); message.getMessages(queueName, receiveTimeOut,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var queue1:Queue = Queue(response); trace("Queue Name is : " + queue1.getQueueName()); trace("Queue Type is : " + queue1.getQueueType()); if(queue1.getMessageList().length > 0) { for(var j:int=0;j<queue1.getMessageList().length;j++) { trace("Correlation id is : " + Message(queue1.getMessageList()[j]).getCorrelationId()); trace("Message is " + Message(queue1.getMessageList()[j]).getMessageId()); trace("PayLoad is " + Message(queue1.getMessageList()[j]).getPayLoad()); } } } }Coming SoonString queueName = "MyQueue"; long receiveTimeOut = 10000; App42API.initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); Queue queue = queueService.getMessages(queueName, receiveTimeOut); System.out.println("queueName is "+ queue.getQueueName()); System.out.println("queueType is "+ queue.getQueueType()); Vector messageList = queue.getMessageList(); for(int i = 0; i < messageList.size(); i++) { System.out.println("correlationId is " + ((Queue.Message)messageList.elementAt(i)).getCorrelationId()); System.out.println("messageId is " + ((Queue.Message)messageList.elementAt(i)).getMessageId()); System.out.println("payLoad is " + ((Queue.Message)messageList.elementAt(i)).getPayLoad()); } String jsonResponse = queue.toString();
Send messages on the queue with an expiry time. The messages will expire if they are not pulled/dequeued before the expiry time.
queueName - The name of the queue to which the message has to be sent.
message - Message that has to be sent.
expiryTime - Message expiry time.
String queueName = "MyQueue"; String message = "App42 Message API."; long expiryTime = 10000; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); queueService.sendMessage(queueName, message, expiryTime, new App42CallBack() { public void onSuccess(Object response) { Queue queue = (Queue)response; System.out.println("queueName is " + queue.getQueueName()); System.out.println("queueType is " + queue.getQueueType()); ArrayList<Queue.Message> messageList = queue.getMessageList(); for(Queue.Message message : messageList) { System.out.println("correlationId is " + message.getCorrelationId()); System.out.println("payLoad is " + message.getPayLoad()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String queueName = "MyQueue"; String message = "App42 Message API."; long expiryTime = 10000; App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); queueService.SendMessage(queueName, message, expiryTime,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Queue queue = (Queue) response; Console.WriteLine("QueueName is : "+ queue.GetQueueName()); Console.WriteLine("QueueType is : "+ queue.GetQueueType()); Console.WriteLine("QueueDescription is : "+ queue.GetDescription()); IList<Queue.Message> messageList = queue.GetMessageList(); for(int i = 0; i<messageList.Count; i++) { Console.WriteLine("CorrelationId is : " + messageList[i].GetCorrelationId()); Console.WriteLine("PayLoad is : " + messageList[i].GetPayLoad()); } String jsonResponse = queue.ToString(); } }NSString *queueName = @"MyQueue"; NSString *message = @"App42 Message API."; long expiryTime = 10000; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; QueueService *queueService = [App42API buildQueueService]; [queueService sendMessage:queueName message:message expiryTime:expiryTime completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Queue *queue = (Queue*)responseObj; NSLog(@"Response is %@" , queue.strResponse); NSLog(@"isResponseSuccess is %d" , queue.isResponseSuccess); for (Message *message in queue.messageArray) { NSLog(@"CorrelationId is =%@", message.correlationId); NSLog(@"MessageId is = %@", message.messageId); NSLog(@"Payload is = %@", message.payLoad); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let queueService = App42API.buildQueueService() as? QueueService let queueName = "MyQueue" let messages = "App42 Message API" let timeOut = 10 queueService?.sendMessage(queueName, message: messages, expiryTime: timeOut, completionBlock:{ (success, response, exception) -> Void in if(success) { let queue = response as! Queue NSLog("Response=%@",queue.strResponse); for message in queue.messageArray { NSLog("CorrelationId is =%@",message.correlationId) NSLog("Payload is = %@",message.payLoad) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) } })String queueName = "MyQueue"; String message = "App42 Message API."; long expiryTime = 10000; App42.initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); Queue queue = queueService.sendMessage(queueName,message, expiryTime); System.out.println("queueName is " + queue.getQueueName()); System.out.println("queueType is " + queue.getQueueType()); ArrayList<Queue.Message> messageList = queue.getMessageList(); for(Queue.Message message : messageList) { System.out.println("correlationId is " + message.getCorrelationId()); System.out.println("payLoad is " + message.getPayLoad()); } String jsonResponse = queue.toString();String queueName = "MyQueue"; String message = "App42 Message API."; long expiryTime = 10000; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); queueService.SendMessage(queueName, message, expiryTime,new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Queue queue = (Queue) response; App42Log.Console("QueueName :" + queue.GetQueueName()); App42Log.Console("QueueType :" + queue.GetQueueType()); IList<Queue.Message> messageList = queue.GetMessageList(); for(int i = 0; i<messageList.Count; i++) { App42Log.Console("CorrelationId : " + messageList[i].GetCorrelationId()); App42Log.Console("PayLoad : " + messageList[i].GetPayLoad()); } App42Log.Console("JsonResponse :" + queue.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing SoonComing SoonString queueName = "MyQueue"; String message = "App42 Message API."; long expiryTime = 10000; App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); Queue queue = queueService.SendMessage(queueName,message, expiryTime); Console.WriteLine("QueueName : "+ queue.GetQueueName()); Console.WriteLine("QueueType : "+ queue.GetQueueType()); IList<Queue.Message> messageList = queue.GetMessageList(); for(int i = 0; i<messageList.Count; i++) { Console.WriteLine("CorrelationId : " + messageList[i].GetCorrelationId()); Console.WriteLine("PayLoad : " + messageList[i].GetPayLoad()); } String jsonResponse = queue.ToString();$queueName = "MyQueue"; $message = "App42 Message API."; $expiryTime = 10000; App42API::initialize("API_KEY","SECRET_KEY"); $queueService = App42API::buildQueueService(); $queue = $queueService->sendMessage($queueName,$message, $expiryTime); print_r("queueName is " . $queue->getQueueName().PHP_EOL); print_r("queueType is " . $queue->getQueueType().PHP_EOL); $message = $queue->getMessageList(); foreach($message as $messageList) { print_r("correlationId is " .$messageList->getCorrelationId().PHP_EOL); print_r("payLoad is " .$messageList->getPayLoad().PHP_EOL); } $jsonResponse = $queue->toString();Coming Soonqueue_name = "MyQueue"; msg = "Message"; exp = 100000; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") queue_service = api.build_queue_service() queue = queue_service.send_message(queue_name, msg, exp); puts "queueName is #{queue.queue_name }"; puts "queueType is #{queue.queue_type}"; message_list = Array.new(); message_list = queue.message_list(); for message in message_list do puts "correlationId is #{message.correlation_id}"; puts "payLoad is #{message.pay_load}"; end json_response = queue.to_s();var queueName:String = "MyQueue"; var message:String = "App42 Message API."; var expiryTime:int = 10000; App42API.initialize("API_KEY","SECRET_KEY"); var queueService:QueueService = App42API.buildQueueService(); var message:QueueService = App42API.buildQueueService(); message.sendMessage(queueName, message, expiryTime,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var queue:Queue = Queue(response); trace("Queue Name is : " + queue.getQueueName()); trace("Queue Type is : " + queue.getQueueType()); if(queue.getMessageList().length > 0) { for(var j:int=0;j<queue.getMessageList().length;j++) { trace("Correlation id is : " + Message(queue.getMessageList()[j]).getCorrelationId()); trace("PayLoad is " + Message(queue.getMessageList()[j]).getPayLoad()); } } } }Coming SoonString queueName = "MyQueue"; String message = "App42 Message API."; long expiryTime = 10000; App42API.initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); Queue queue = queueService.sendMessage(queueName,message, expiryTime); System.out.println("queueName is "+ queue.getQueueName()); System.out.println("queueType is "+ queue.getQueueType()); Vector messageList = queue.getMessageList(); for(int i = 0; i < messageList.size(); i++) { System.out.println("correlationId is " + ((Queue.Message)messageList.elementAt(i)).getCorrelationId()); System.out.println("payLoad is " + ((Queue.Message)messageList.elementAt(i)).getPayLoad()); } String jsonResponse = queue.toString();
Pull all the messages from the queue.
Required Parameters
queueName - The name of the queue from which messages have to be pulled.
receiveTimeOut - Receive timed out (in milliseconds).
String queueName = "MyQueue"; long receiveTimeOut = 10000; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); queueService.receiveMessage(queueName, receiveTimeOut, new App42CallBack() { public void onSuccess(Object response) { Queue queue = (Queue)response; System.out.println("queueName is " + queue.getQueueName()); System.out.println("queueType is " + queue.getQueueType()); ArrayList<Queue.Message> messageList = queue.getMessageList(); for(Queue.Message message : messageList) { System.out.println("correlationId is " + message.getCorrelationId()); System.out.println("messageId is " + message.getMessageId()); System.out.println("payLoad is " + message.getPayLoad()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String queueName = "MyQueue"; long receiveTimeOut = 10000; App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); queueService.ReceiveMessage(queueName, receiveTimeOut,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Queue queue = (Queue) response; Console.WriteLine("QueueName is : "+ queue.GetQueueName()); Console.WriteLine("QueueType is : "+ queue.GetQueueType()); Console.WriteLine("QueueDescription is : "+ queue.GetDescription()); IList<Queue.Message> messageList = queue.GetMessageList(); for(int i = 0; i<messageList.Count; i++) { Console.WriteLine("CorrelationId is : " + messageList[i].GetCorrelationId()); Console.WriteLine("MessageId is : " + messageList[i].GetMessageId()); Console.WriteLine("PayLoad is : " + messageList[i].GetPayLoad()); } String jsonResponse = queue.ToString(); } }NSString *queueName = @"MyQueue"; long receiveTimeOut = 10000; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; QueueService *queueService = [App42API buildQueueService]; [queueService receiveMessage:queueName receiveTimeOut:receiveTimeOut completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Queue *queue = (Queue*)responseObj; NSLog(@"Response is %@" , queue.strResponse); NSLog(@"isResponseSuccess is %d" , queue.isResponseSuccess); for (Message *message in queue.messageArray) { NSLog(@"CorrelationId is =%@", message.correlationId); NSLog(@"MessageId is = %@", message.messageId); NSLog(@"Payload is = %@", message.payLoad); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let queueService = App42API.buildQueueService() as? QueueService let queueName = "TestQueue" let timeOut = 10 queueService?.receiveMessage(queueName, receiveTimeOut: timeOut, completionBlock:{ (success, response, exception) -> Void in if(success) { let queue = response as! Queue NSLog("Response=%@",queue.strResponse); for message in queue.messageArray { NSLog("CorrelationId is =%@",message.correlationId) NSLog("MessageId is =%@",message.messageId) NSLog("Payload is = %@",message.payLoad) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) } })String queueName = "MyQueue"; long receiveTimeOut = 10000; App42.initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); Queue queue = queueService.receiveMessage(queueName, receiveTimeOut); System.out.println("queueName is " + queue.getQueueName()); System.out.println("queueType is " + queue.getQueueType()); ArrayList<Queue.Message> messageList = queue.getMessageList(); for(Queue.Message message : messageList) { System.out.println("correlationId is " + message.getCorrelationId()); System.out.println("messageId is " + message.getMessageId()); System.out.println("payLoad is " + message.getPayLoad()); } String jsonResponse = queue.toString();String queueName = "MyQueue"; long receiveTimeOut = 10000; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); queueService.ReceiveMessage(queueName, receiveTimeOut, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Queue queue = (Queue) response; App42Log.Console("QueueName :" + queue.GetQueueName()); App42Log.Console("QueueType :" + queue.GetQueueType()); IList<Queue.Message> messageList = queue.GetMessageList(); for(int i = 0; i<messageList.Count; i++) { App42Log.Console("CorrelationId : " + messageList[i].GetCorrelationId()); App42Log.Console("MessageId : " + messageList[i].GetMessageId()); App42Log.Console("PayLoad : " + messageList[i].GetPayLoad()); } App42Log.Console("JsonResponse :" + queue.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing SoonComing SoonString queueName = "MyQueue"; long receiveTimeOut = 10000; App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); Queue queue = queueService.ReceiveMessage(queueName, receiveTimeOut); Console.WriteLine("QueueName : "+ queue.GetQueueName()); Console.WriteLine("QueueType : "+ queue.GetQueueType()); IList<Queue.Message> messageList = queue.GetMessageList(); for(int i = 0; i<messageList.Count; i++) { Console.WriteLine("CorrelationId : " + messageList[i].GetCorrelationId()); Console.WriteLine("MessageId : " + messageList[i].GetMessageId()); Console.WriteLine("PayLoad : " + messageList[i].GetPayLoad()); } String jsonResponse = queue.ToString();$queueName = "MyQueue"; $receiveTimeOut = 10000; App42API::initialize("API_KEY","SECRET_KEY"); $queueService = App42API::buildQueueService(); $queue = $queueService->receiveMessage($queueName, $receiveTimeOut); print_r("queueName is " . $queue->getQueueName().PHP_EOL); print_r("queueType is " . $queue->getQueueType().PHP_EOL); $message = $queue->getMessageList(); foreach($message as $messageList) { print_r("correlationId is " .$messageList->getCorrelationId().PHP_EOL); print_r("messageId is " .$messageList->getMessageId().PHP_EOL); print_r("payLoad is " .$messageList->getPayLoad().PHP_EOL); } $jsonResponse = $queue->toString();Coming Soonqueue_name ="MyQueue"; receive_time_out = 10000; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") queue_service = api.build_queue_service() queue = queue_service.receive_message(queue_name, receive_time_out); puts "queueName is #{queue.queue_name}"; puts "queueType is #{queue.queue_type}"; message_list = Array.new(); message_list = queue.message_list(); for message in message_list puts "correlationId is #{message.correlation_id}"; puts "messageId is #{message.message_id}"; puts "payLoad is #{message.pay_load}"; end json_response = queue.to_s();var queueName:String = "MyQueue"; var receiveTimeOut:int = 10000; App42API.initialize("API_KEY","SECRET_KEY"); var queueService:QueueService = App42API.buildQueueService(); var message:QueueService = App42API.buildQueueService(); message.receiveMessage(queueName, receiveTimeOut,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var queue1:Queue = Queue(response); trace("Queue Name is : " + queue1.getQueueName()); trace("Queue Type is : " + queue1.getQueueType()); if(queue1.getMessageList().length > 0) { for(var j:int=0;j<queue1.getMessageList().length;j++) { trace("Correlation id is : " + Message(queue1.getMessageList()[j]).getCorrelationId()); trace("Message is " + Message(queue1.getMessageList()[j]).getMessageId()); trace("PayLoad is " + Message(queue1.getMessageList()[j]).getPayLoad()); } } } }Coming SoonString queueName = "MyQueue"; long receiveTimeOut = 10000; App42API.initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); Queue queue = queueService.receiveMessage(queueName, receiveTimeOut); System.out.println("queueName is "+ queue.getQueueName()); System.out.println("queueType is "+ queue.getQueueType()); Vector messageList = queue.getMessageList(); for(int i = 0; i < messageList.size(); i++) { System.out.println("correlationId is " + ((Queue.Message)messageList.elementAt(i)).getCorrelationId()); System.out.println("messageId is " + ((Queue.Message)messageList.elementAt(i)).getMessageId()); System.out.println("payLoad is " + ((Queue.Message)messageList.elementAt(i)).getPayLoad()); } String jsonResponse = queue.toString();
Pull messages based on the correlation ID.
Required Parameters
queueName - The name of the queue from which messages have to be pulled.
receiveTimeOut - Receive timed out (in milliseconds).
correlationId - Correlation ID for which message has to be pulled.
String queueName = "MyQueue"; long receiveTimeOut = 10000; String correlationId = "Correlation Id"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); queueService.receiveMessageByCorrelationId(queueName, receiveTimeOut, correlationId, new App42CallBack() { public void onSuccess(Object response) { Queue queue = (Queue)response; System.out.println("queueName is " + queue.getQueueName()); System.out.println("queueType is " + queue.getQueueType()); ArrayList<Queue.Message> messageList = queue.getMessageList(); for(Queue.Message message : messageList) { System.out.println("correlationId is " + message.getCorrelationId()); System.out.println("messageId is " + message.getMessageId()); System.out.println("payLoad is " + message.getPayLoad()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String queueName = "MyQueue"; long receiveTimeOut = 10000; String correlationId = "Correlation Id"; App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); queueService.ReceiveMessageByCorrelationId(queueName, receiveTimeOut,correlationId,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Queue queue = (Queue) response; Console.WriteLine("QueueName is : "+ queue.GetQueueName()); Console.WriteLine("QueueType is : "+ queue.GetQueueType()); Console.WriteLine("QueueDescription is : "+ queue.GetDescription()); IList<Queue.Message> messageList = queue.GetMessageList(); for(int i = 0; i<messageList.Count; i++) { Console.WriteLine("CorrelationId is : " + messageList[i].GetCorrelationId()); Console.WriteLine("MessageId is : " + messageList[i].GetMessageId()); Console.WriteLine("PayLoad is : " + messageList[i].GetPayLoad()); } String jsonResponse = queue.ToString(); } }NSString *queueName = @"MyQueue"; long receiveTimeOut = 10000; NSString *correlationId = @"Correlation Id"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; QueueService *queueService = [App42API buildQueueService]; [queueService receiveMessageByCorrelationId:queueName receiveTimeOut:receiveTimeOut correlationId:correlationId completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Queue *queue = (Queue*)responseObj; NSLog(@"Response is %@" , queue.strResponse); NSLog(@"isResponseSuccess is %d" , queue.isResponseSuccess); for (Message *message in queue.messageArray) { NSLog(@"CorrelationId is =%@", message.correlationId); NSLog(@"MessageId is = %@", message.messageId); NSLog(@"Payload is = %@", message.payLoad); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let queueService = App42API.buildQueueService() as? QueueService let queueName = "MyQueue" let timeOut = 10 let correlationId = "Correlation Id" queueService?.receiveMessageByCorrelationId(queueName, receiveTimeOut: timeOut, correlationId: correlationId, completionBlock:{ (success, response, exception) -> Void in if(success) { let queue = response as! Queue NSLog("Response=%@",queue.strResponse); for message in queue.messageArray { NSLog("CorrelationId is =%@",message.correlationId) NSLog("MessageId is =%@",message.messageId) NSLog("Payload is = %@",message.payLoad) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) } })String queueName = "MyQueue"; long receiveTimeOut = 10000; String correlationId = "Correlation Id"; App42.initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); Queue queue = queueService.receiveMessageByCorrelationId(queueName, receiveTimeOut,correlationId); System.out.println("queueName is " + queue.getQueueName()); System.out.println("queueType is " + queue.getQueueType()); ArrayList<Queue.Message> messageList = queue.getMessageList(); for(Queue.Message message : messageList) { System.out.println("correlationId is " + message.getCorrelationId()); System.out.println("messageId is " + message.getMessageId()); System.out.println("payLoad is " + message.getPayLoad()); } String jsonResponse = queue.toString();String queueName = "MyQueue"; long receiveTimeOut = 10000; String correlationId = "Correlation Id"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); queueService.ReceiveMessageByCorrelationId(queueName, receiveTimeOut, correlationId, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Queue queue = (Queue) response; App42Log.Console("QueueName :" + queue.GetQueueName()); App42Log.Console("QueueType :" + queue.GetQueueType()); IList<Queue.Message> messageList = queue.GetMessageList(); for(int i = 0; i<messageList.Count; i++) { App42Log.Console("CorrelationId : " + messageList[i].GetCorrelationId()); App42Log.Console("MessageId : " + messageList[i].GetMessageId()); App42Log.Console("PayLoad : " + messageList[i].GetPayLoad()); } App42Log.Console("JsonResponse :" + queue.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing SoonComing SoonString queueName = "MyQueue"; long receiveTimeOut = 10000; String correlationId = "Correlation Id"; App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); Queue queue = queueService.ReceiveMessageByCorrelationId(queueName, receiveTimeOut,correlationId); Console.WriteLine("QueueName : "+ queue.GetQueueName()); Console.WriteLine("QueueType : "+ queue.GetQueueType()); IList<Queue.Message> messageList = queue.GetMessageList(); for(int i = 0; i<messageList.Count; i++) { Console.WriteLine("CorrelationId : " + messageList[i].GetCorrelationId()); Console.WriteLine("MessageId : " + messageList[i].GetMessageId()); Console.WriteLine("PayLoad : " + messageList[i].GetPayLoad()); } String jsonResponse = queue.ToString();$queueName = "MyQueue"; $receiveTimeOut = 10000; $correlationId = "Correlation Id"; App42API::initialize("API_KEY","SECRET_KEY"); $queueService = App42API::buildQueueService(); $queue = $queueService->receiveMessageByCorrelationId($queueName, $receiveTimeOut,$correlationId); print_r("queueName is " . $queue->getQueueName().PHP_EOL); print_r("queueType is " . $queue->getQueueType().PHP_EOL); $message = $queue->getMessageList(); foreach($message as $messageList) { print_r("correlationId is " .$messageList->getCorrelationId().PHP_EOL); print_r("messageId is " .$messageList->getMessageId().PHP_EOL); print_r("payLoad is " .$messageList->getPayLoad().PHP_EOL); } $jsonResponse = $queue->toString();Coming Soonqueue_name = "MyQueue"; receive_time_out = 10000; correlation_id = "Correlation Id"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") queue_service = api.build_queue_service() queue = queue_service.receive_message_by_correlation_id(queue_name, receive_time_out, correlation_id); puts "queueName is #{queue.queue_name}"; puts "queueType is #{queue.queue_type}"; message_list = Array.new(); message_list = queue.message_list(); for message in message_list do puts "correlationId is #{message.correlation_id}"; puts "messageId is #{message.message_id}"; puts "payLoad is #{message.pay_load}"; end json_response = queue.to_s();var queueName:String = "MyQueue"; var receiveTimeOut:int = 10000; var correlationId:String = "Correlation Id"; App42API.initialize("API_KEY","SECRET_KEY"); var queueService:QueueService = App42API.buildQueueService(); var message:QueueService = App42API.buildQueueService(); message.receiveMessageByCorrelationId(queueName, receiveTimeOut,correlationId,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var queue1:Queue = Queue(response); trace("Queue Name is : " + queue1.getQueueName()); trace("Queue Type is : " + queue1.getQueueType()); if(queue1.getMessageList().length > 0) { for(var j:int=0;j<queue1.getMessageList().length;j++) { trace("Correlation id is : " + Message(queue1.getMessageList()[j]).getCorrelationId()); trace("Message is " + Message(queue1.getMessageList()[j]).getMessageId()); trace("PayLoad is " + Message(queue1.getMessageList()[j]).getPayLoad()); } } } }Coming SoonString queueName = "MyQueue"; long receiveTimeOut = 10000; String correlationId = "Correlation Id"; App42API.initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); Queue queue = queueService.receiveMessageByCorrelationId(queueName, receiveTimeOut,correlationId); System.out.println("queueName is "+ queue.getQueueName()); System.out.println("queueType is "+ queue.getQueueType()); Vector messageList = queue.getMessageList(); for(int i = 0; i < messageList.size(); i++) { System.out.println("correlationId is " + ((Queue.Message)messageList.elementAt(i)).getCorrelationId()); System.out.println("messageId is " + ((Queue.Message)messageList.elementAt(i)).getMessageId()); System.out.println("payLoad is " + ((Queue.Message)messageList.elementAt(i)).getPayLoad()); } String jsonResponse = queue.toString();
Remove messages from the queue based on the message ID.
Note: Once the message is removed it cannot be pulled.
Required Parameters
queueName - The name of the queue from which the message has to be removed.
messageId - The ID of the message which has to be removed.
String queueName = "MyQueue"; String messageId = "Message Id"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); queueService.removeMessage(queueName, messageId, new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("response is " + app42response) ; } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String queueName = "MyQueue"; String messageId = "Message Id"; App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); queueService.RemoveMessage(queueName,messageId,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { App42Response app42response = (App42Response) response; Console.WriteLine("App42Response is : " + app42response) ; String jsonResponse = app42response.ToString(); } }NSString *queueName = @"MyQueue"; NSString *messageId = @"Message Id"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; QueueService *queueService = [App42API buildQueueService]; [queueService removeMessage:queueName messageId:messageId completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { App42Response *response = (App42Response*)responseObj; NSString *success = response.isResponseSuccess; NSString *jsonResponse = [response toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let queueService = App42API.buildQueueService() as? QueueService let queueName = "MyQueue" let messageId = "Message Id" queueService?.removeMessage(queueName, messageId: messageId, completionBlock:{ (success, response, exception) -> Void in if(success) { let app42Response = response as! App42Response NSLog("Response=%@",app42Response.strResponse); } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) } })String queueName = "MyQueue"; String messageId = "Message Id"; App42.initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); App42Response app42response = queueService.removeMessage(queueName,messageId); System.out.println("response is " + app42response); boolean success = app42response.isResponseSuccess(); String jsonResponse = app42response.toString();String queueName = "MyQueue"; String messageId = "Message Id"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); queueService.RemoveMessage(queueName,messageId, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42Response = (App42Response) response; App42Log.Console("App42Response is :" + app42Response.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing SoonComing SoonString queueName = "MyQueue"; String messageId = "Message Id"; App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); App42Response app42response = queueService.RemoveMessage(queueName,messageId); Console.WriteLine("App42Response is : " + app42response) ; Boolean success = app42response.IsResponseSuccess(); String jsonResponse = app42response.ToString();$queueName = "MyQueue"; $messageId = "Message Id"; App42API::initialize("API_KEY","SECRET_KEY"); $queueService = App42API::buildQueueService(); $response = $queueService->removeMessage($queueName,$messageId); print_r("Response is : ".$response->toString()); $success = $response->isResponseSuccess(); $jsonResponse = $response->toString();Coming Soonqueue_name = "MyQueue"; message_id = "Message Id"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") queue_service = api.build_queue_service() response = queue_service.remove_message(queue_name, message_id); success = response.is_response_success(); json_response = response.to_s()var queueName:String = "MyQueue"; var messageId:String = "Message Id"; App42API.initialize("API_KEY","SECRET_KEY"); var queueService:QueueService = App42API.buildQueueService(); var message:QueueService = App42API.buildQueueService(); message.removeMessage(queueName,messageId,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var app42response :App42Response= App42Response(response); trace("response is " + app42response) } }Coming SoonString queueName = "MyQueue"; String messageId = "Message Id"; App42API.initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); App42Response app42response = queueService.removeMessage(queueName,messageId); boolean success = app42response.isResponseSuccess(); System.out.println("response is " + app42response); String jsonResponse = app42response.toString();
Delete the pull type queue.
Required Parameters
queueName - The name of the queue which has to be deleted.
String queueName = "MyQueue"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); queueService.deletePullQueue(queueName, new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("response is " + app42response) ; } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String queueName = "MyQueue"; App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); queueService.DeletePullQueue(queueName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { App42Response app42response = (App42Response) response; Console.WriteLine("App42Response is : " + app42response) ; String jsonResponse = app42response.ToString(); } }NSString *queueName = @"MyQueue"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; QueueService *queueService = [App42API buildQueueService]; [queueService deletePullQueue:queueName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { App42Response *response = (App42Response*)responseObj; NSString *success = response.isResponseSuccess; NSString *jsonResponse = [response toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let queueService = App42API.buildQueueService() as? QueueService let queueName = "TestQueue" queueService?.deletePullQueue(queueName, completionBlock:{ (success, response, exception) -> Void in if(success) { let app42Response = response as! App42Response NSLog("Response=%@",app42Response.strResponse); } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) } })String queueName = "MyQueue"; App42.initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); App42Response app42response = queueService.deletePullQueue(queueName); System.out.println("response is " + app42response) ; boolean success = app42response.isResponseSuccess(); String jsonResponse = app42response.toString();String queueName = "MyQueue"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); queueService.DeletePullQueue(queueName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42Response = (App42Response) response; App42Log.Console("App42Response is :" + app42Response.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing SoonComing SoonString queueName = "MyQueue"; App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); App42Response app42response = queueService.DeletePullQueue(queueName); Console.WriteLine("App42Response is : " + app42response) ; Boolean success = app42response.IsResponseSuccess(); String jsonResponse = app42response.ToString();$queueName = "MyQueue"; $response = $queueService->deletePullQueue($queueName); print_r("Response is : ".$response->toString().PHP_EOL); $success = $response->isResponseSuccess(); $jsonResponse = $response->toString();Coming Soonqueue_name = "MyQueue"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") queue_service = api.build_queue_service() response = queue_service.delete_pull_queue(queue_name); success = response.is_response_success(); json_response = response.to_s();var queueName:String = "MyQueue"; App42API.initialize("API_KEY","SECRET_KEY"); var queueService:QueueService = App42API.buildQueueService(); var message:QueueService = App42API.buildQueueService(); queueService.deletePullQueue(queueName,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var app42response :App42Response= App42Response(response); trace("response is " + app42response) } }Coming SoonString queueName = "MyQueue"; App42API.initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); App42Response app42response = queueService.deletePullQueue(queueName); boolean success = app42response.isResponseSuccess(); System.out.println("response is " + app42response); String jsonResponse = app42response.toString();
The functions available under Message/Queue API can throw some exceptions in abnormal conditions. For example, if a developer is sending a message on the queue which has not been created, the function will throw the App42Exception (as shown below) with message as “Not Found” and the appErrorCode as “2400” and the details as “Queue with the name ‘@queueName’ not found”.
String queueName = "MyQueue"; String msg = "Message"; long exp = 100000; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); queueService.sendMessage(queueName, msg, exp, new App42CallBack() { public void onSuccess(Object response) { Queue queue = (Queue)response; System.out.println("queueName is " + queue.getQueueName()); System.out.println("queueType is " + queue.getQueueType()); ArrayList<Queue.Message> messageList = queue.getMessageList(); for(Queue.Message message : messageList) { System.out.println("correlationId is " + message.getCorrelationId()); System.out.println("payLoad is " + message.getPayLoad()); } } public void onException(Exception ex) { App42Exception exception = (App42Exception)ex; int appErrorCode = exception.getAppErrorCode(); int httpErrorCode = exception.getHttpErrorCode(); if(appErrorCode == 2400) { // Handle here for Not Found (Queue with the name '@queueName> not found.) } else if(appErrorCode == 1401) { // Handle here for Client is not authorized } else if(appErrorCode == 1500) { // Handle here for Internal Server Error } String jsonText = ex.getMessage(); } });String queueName = "MyQueue"; String msg = "Message"; long exp = 100000; App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); queueService.SendMessage(queueName, msg, exp, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { int appErrorCode = exception.GetAppErrorCode(); int httpErrorCode = exception.GetHttpErrorCode(); if(appErrorCode == 2400) { // Handle here for Not Found (Queue with the name '@queueName> not found.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.GetMessage(); } public void OnSuccess(Object response) { Queue queue = (Queue) response; String jsonResponse = queue.ToString(); } }NSString *queueName = @"MyQueue"; NSString *msg = @"Message"; long exp = 100000; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; QueueService *queueService = [App42API buildQueueService]; [queueService sendMessage:queueName message:msg expiryTime:exp completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Queue *queue = (Queue*)responseObj; NSLog(@"Response is %@" , queue.strResponse); } else { int appErrorCode = exception.appErrorCode; int httpErrorCode = exception.httpErrorCode; if(appErrorCode == 2400) { // Handle here for Not Found (Queue with the name '@queueName> not found.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } NSString *jsonText = exception.reason; } }];coming soonString queueName = "MyQueue"; String msg = "Message"; long exp = 100000; App42.initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); try { Queue queue = queueService.sendMessage(queueName, msg, exp); } catch(App42Exception ex) { int appErrorCode = ex.getAppErrorCode(); int httpErrorCode = ex.getHttpErrorCode(); if(appErrorCode == 2400) { // Handle here for Not Found (Queue with the name '@queueName> not found.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = ex.getMessage(); }String queueName = "MyQueue"; String msg = "Message"; long exp = 100000; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); queueService.SendMessage(queueName, msg, exp, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnException(Exception e) { App42Exception ex = (App42Exception)e; int appErrorCode = ex.GetAppErrorCode(); int httpErrorCode = ex.GetHttpErrorCode(); if(appErrorCode == 2400) { // Handle here for Not Found (Queue with the name '@queueName> not found.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = ex.GetMessage(); } public void OnSuccess(object response) { App42Log.Console("response is :" + response.ToString()); } }Not AvailableComing SoonComing SoonString queueName = "MyQueue"; String msg = "Message"; long exp = 100000; App42API.Initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.BuildQueueService(); try { Queue queue = queueService.SendMessage(queueName, msg, exp); } catch(App42Exception ex) { int appErrorCode = ex.GetAppErrorCode(); int httpErrorCode = ex.GetHttpErrorCode(); if(appErrorCode == 2400) { // Handle here for Not Found (Queue with the name '@queueName> not found.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = ex.GetMessage(); }$queueName = "MyQueue"; $msg = "Message"; $exp = 100000; App42API::initialize("API_KEY","SECRET_KEY"); $queueService = App42API::buildQueueService(); try{ $queue = $queueService->sendMessage($queueName, $msg, $exp); } catch(App42Exception $ex) { $appErrorCode = $ex->getAppErrorCode(); $httpErrorCode = $ex->getHttpErrorCode(); if(appErrorCode == 2400) { // Handle here for Not Found (Queue with the name '@queueName' not found.) } else if(appErrorCode == 1401){ // handle here for Client is not authorized } else if(appErrorCode == 1500){ // handle here for Internal Server Error } $jsonText = $ex->getMessage(); /* returns the Exception text in JSON format. (as shown below)*/ }Coming SoonComing SoonComing SoonComing SoonString queueName = "MyQueue"; String msg = "Message"; long exp = 100000; App42API.initialize("API_KEY","SECRET_KEY"); QueueService queueService = App42API.buildQueueService(); try { Queue queue = queueService.sendMessage(queueName, msg, exp); } catch(App42Exception ex) { int appErrorCode = ex.getAppErrorCode(); int httpErrorCode = ex.getHttpErrorCode(); if(appErrorCode == 2400) { // Handle here for Not Found (Queue with the name '@queueName> not found.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = ex.getMessage(); }
Functions in Message API might throw exceptions with following HTTP and Application Error Codes (along with their descriptions):
1400 - BAD REQUEST - The requested parameters are invalid.
1401 - UNAUTHORIZED - Client is not authorized.
1500 - INTERNAL SERVER ERROR - Internal Server Error. Please try again.
2400 - NOT FOUND - Queue with the name '@queueName' not found.
2401 - NOT FOUND - Queue with the name '@queueName' does not have any messages.
2402 - NOT FOUND - Queue with the name '@queueName' and correlationId '@correlationId' does not have any messages.
2403 - BAD REQUEST - Queue by the name '@queueName' already exists.
2404 - BAD REQUEST - The request parameters are invalid. This action is only applicable for PULL type queue.
2405 - NOT FOUND - Queue with the name '@queueName' does not have any pending messages.