Message API Package / Service consists of Message and Queue APIs.
Message – This module provides Message Service APIs for sending, pulling and removing Message from a particular queue. Asynchronous messages can be sent to a queue that can be pulled through various message already received.
Queue – This module also manages Asynchronous queues and allows you to Create, Delete, Purge messages, View Pending messages and Get all messages in specific queues.
In order to use various functions available in a specific API, a developer has to create an instance of ServiceAPI by passing the apiKey and secretKey which will be created 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.
ServiceAPI api = new ServiceAPI("API_KEY","SECRET_KEY");ServiceAPI api = new ServiceAPI("API_KEY","SECRET_KEY");ServiceAPI *api = [[ServiceAPI alloc]init]; api.apiKey = @"<API_KEY>"; api.secretKey = @"<SECRET_KEY>";ServiceAPI api = new ServiceAPI("API_KEY","SECRET_KEY");ServiceAPI api = new ServiceAPI("API_KEY","SECRET_KEY");Coming SoonServiceAPI api = new ServiceAPI("API_KEY","SECRET_KEY");App42.initialize("API_KEY","SECRET_KEY");$api = new ServiceAPI("API_KEY","SECRET_KEY");Coming Soonapi = App42::ServiceAPI.new("<API_KEY>","<SECRET_KEY>")Coming SoonComing Soon
After initialization, developer needs to call the buildXXXService method on ServiceAPI instance to get the instance of the particular API that you wish to build. For example, To build an instance of QueueService, buildQueueService() method needs to be called.
QueueService queueService = api.buildQueueService();QueueService queueService = api.BuildQueueService();QueueService *queueService = [api buildQueueService];QueueService queueService = api.buildQueueService();QueueService queueService = api.buildQueueService();Coming SoonNot AvailableQueueService queueService = api.BuildQueueService();$queueService = $api->buildQueueService();Coming Soonqueue_service = api.build_queue_service()Coming SoonComing Soon
import com.shephertz.app42.paas.sdk.android.ServiceAPI; 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 com.shephertz.app42.paas.sdk.jme.ServiceAPI; 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;import com.shephertz.app42.paas.sdk.java.ServiceAPI; 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;Coming SoonNot Availableusing com.shephertz.app42.paas.sdk.csharp; using com.shephertz.app42.paas.sdk.csharp.message;use com\shephertz\app42\paas\sdk\php\App42Response; use com\shephertz\app42\paas\sdk\php\App42Exception; use com\shephertz\app42\paas\sdk\php\App42BadParameterException; use com\shephertz\app42\paas\sdk\php\App42NotFoundException; use com\shephertz\app42\paas\sdk\php\message\QueueService; use com\shephertz\app42\paas\sdk\php\ServiceAPI; include_once '../QueueService.php'; include_once '../ServiceAPI.php'; include_once '../App42Response.php'; include_once '../App42Exception.php'; include_once '../App42BadParameterException.php'; include_once '../App42NotFoundException.php';Coming Soonrequire 'App42_Ruby_API'Coming SoonComing Soon
Creates a type Pull Queue.
Required Parameters
queueName - The name of the queue which has to be created.
queueDescription - The description of the queue
String queueName = "MyQueue"; String queueDescription = "Hi its testing Time"; Queue queue = queueService.createPullQueue(queueName, queueDescription); System.out.println("queueName is "+ queue.getQueueName()); System.out.println("queueType is "+ queue.getQueueType()); String jsonResponse = queue.toString();public class Callback : App42Callback { String queueName = "MyQueue"; String queueDescription = "Hi its testing Time"; queueService.CreatePullQueue(queueName, queueDescription,this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Queue queue = (Queue) response; Console.WriteLine("queueName is "+ queue.getQueueName()); Console.WriteLine("queueType is "+ queue.getQueueType()); String jsonResponse = queue.ToString(); } }NSString *queueName = @"MyQueue"; NSString *queueDescription = @"Hi its testing Time"; Queue *queue = [queueService createPullQueue:queueName description:description]; NSLog(@"queueName is = %@",queue.queueName); NSLog(@"queueType is= %@",queue.queueType); NSString *jsonResponse = [queue toString];String queueName = "MyQueue"; String queueDescription = "Hi its testing Time"; Queue queue = queueService.createPullQueue(queueName, queueDescription); System.out.println("queueName is "+ queue.getQueueName()); System.out.println("queueType is "+ queue.getQueueType()); String jsonResponse = queue.toString();String queueName = "MyQueue"; String queueDescription = "Hi its testing Time"; Queue queue = queueService.createPullQueue(queueName, queueDescription); System.out.println("queueName is "+ queue.getQueueName()); System.out.println("queueType is "+ queue.getQueueType()); String jsonResponse = queue.toString();Coming SoonNot AvailableString queueName = "MyQueue"; String queueDescription = "Hi its testing Time"; Queue queue = queueService.CreatePullQueue(queueName, queueDescription); Console.WriteLine("queueName is "+ queue.getQueueName()); Console.WriteLine("queueType is "+ queue.getQueueType()); String jsonResponse = queue.toString();$queueName = "MyQueue"; $queueDescription = "Hi its testing Time"; $queue = $queueService->createPullQueue($queueName, $queueDescription); print_r("queueName is" . $queue->getQueueName()); print_r("queueType is" . $queue->getQueueType()); $jsonResponse = $queue->toString();Coming Soonqueue_name = "MyQueue"; queue_description = "Hi its testing Time"; 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();Coming SoonComing Soon
Purges message on the Queue. Note: once the Queue is purged the messages are removed from the Queue and wont be available for dequeuing.
Required Parameters
queueName - The name of the queue which has to be purged.
String queueName = "MyQueue"; App42Response response = queueService.purgePullQueue(queueName); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();public class Callback : App42Callback { String queueName = "MyQueue"; queueService.PurgePullQueue(queueName,this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { App42Response success = (App42Response) response; String jsonResponse = success.ToString(); } }NSString *queueName = @"MyQueue"; App42Response *response = [queueService purgePullQueue:queueName]; NSString *success = response.isResponseSuccess; NSString *jsonResponse = [response toString];String queueName = "MyQueue"; App42Response response = queueService.purgePullQueue(queueName); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();String queueName = "MyQueue"; App42Response response = queueService.purgePullQueue(queueName); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();Coming SoonNot AvailableString queueName = "MyQueue"; App42Response response = queueService.PurgePullQueue(queueName); Boolean success = response.IsResponseSuccess(); String jsonResponse = response.ToString();$queueName = "MyQueue"; $response = $queueService->purgePullQueue($queueName); $success = $respons->isResponseSuccess(); $jsonResponse = $respons->toString();Coming Soonqueue_name = "MyQueue"; response = queue_service.purge_pull_queue(queue_name); success = response.is_response_success(); json_response = response.to_s();Coming SoonComing Soon
Messages which are pending to be dequeue. 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"; Queue queue = queueService.pendingMessages(queueName); System.out.println("queueName is "+ queue.getQueueName()); System.out.println("queueType is "+ queue.getQueueType()); String jsonResponse = queue.toString();public class Callback : App42Callback { String queueName = "MyQueue"; queueService.PendingMessages(queueName,this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Queue queue = (Queue) response; Console.WriteLine("queueName is "+ queue.getQueueName()); Console.WriteLine("queueType is "+ queue.getQueueType()); String jsonResponse = queue.ToString(); } }NSString *queueName = @"MyQueue"; Queue *queue = [queueService pendingMessages:queueName]; NSLog(@"queueName is = %@",queue.queueName); NSLog(@"queueType is= %@",queue.queueType); NSString *jsonResponse = [queue toString];String queueName = "MyQueue"; Queue queue = queueService.pendingMessages(queueName); System.out.println("queueName is "+ queue.getQueueName()); System.out.println("queueType is "+ queue.getQueueType()); String jsonResponse = queue.toString();String queueName = "MyQueue"; Queue queue = queueService.pendingMessages(queueName); System.out.println("queueName is "+ queue.getQueueName()); System.out.println("queueType is "+ queue.getQueueType()); String jsonResponse = queue.toString();Coming SoonNot AvailableString queueName = "MyQueue"; Queue queue = queueService.PendingMessages(queueName); Console.WriteLine("queueName is "+ queue.getQueueName()); Console.WriteLine("queueType is "+ queue.getQueueType()); String jsonResponse = queue.toString();$queueName = "MyQueue"; $queue = $queueService->pendingMessages($queueName); print_r("queueName is" . $queue->getQueueName()); print_r("queueType is" . $queue->getQueueType()); $jsonResponse = $queue->toString();Coming Soonqueue_name = "MyQueue"; 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();Coming SoonComing Soon
Messages are retrieved and dequeued from the Queue.
Required Parameters
queueName - The name of the queue which have to be retrieved.
receiveTimeOut - Receive time out (in milli seconds).
String queueName = "MyQueue"; long receiveTimeOut = 10000; Queue queue = queueService.getMessages(queueName, receiveTimeOut); System.out.println("queueName is "+ queue.getQueueName()); System.out.println("queueType is "+ queue.getQueueType()); String jsonResponse = queue.toString();public class Callback : App42Callback { String queueName = "MyQueue"; long receiveTimeOut = 10000; queueService.GetMessages(queueName, receiveTimeOut,this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Queue queue = (Queue) response; Console.WriteLine("queueName is "+ queue.getQueueName()); Console.WriteLine("queueType is "+ queue.getQueueType()); String jsonResponse = queue.ToString(); } }NSString *queueName = @"MyQueue"; long receiveTimeOut = 10000; Queue *queue = [queueService getMessages:queueName receiveTimeOut:receiveTimeOut]; NSLog(@"queueName is = %@",queue.queueName); NSLog(@"queueType is= %@",queue.queueType); NSString *jsonResponse = [queue toString];String queueName = "MyQueue"; long receiveTimeOut = 10000; Queue queue = queueService.getMessages(queueName, receiveTimeOut); System.out.println("queueName is "+ queue.getQueueName()); System.out.println("queueType is "+ queue.getQueueType()); String jsonResponse = queue.toString();String queueName = "MyQueue"; long receiveTimeOut = 10000; Queue queue = queueService.getMessages(queueName, receiveTimeOut); System.out.println("queueName is "+ queue.getQueueName()); System.out.println("queueType is "+ queue.getQueueType()); String jsonResponse = queue.toString();Coming SoonNot AvailableString queueName = "MyQueue"; long receiveTimeOut = 10000; Queue queue = queueService.GetMessages(queueName, receiveTimeOut); Console.WriteLine("queueName is "+ queue.getQueueName()); Console.WriteLine("queueType is "+ queue.getQueueType()); String jsonResponse = queue.toString();$queueName = "MyQueue"; $receiveTimeOut = 10000; $queue = $queueService->getMessages($queueName, $receiveTimeOut); print_r("queueName is" . $queue->getQueueName()); print_r("queueType is" . $queue->getQueueType()); $jsonResponse = $queue->toString();Coming Soonqueue_name = "MyQueue"; receive_time_out = 10000; 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();Coming SoonComing Soon
Send message on the queue with an expiry. The message will expire if it is not pulled/dequeued before the expiry.
queueName - The name of the queue to which he message has to be sent.
message - Message that has to be sent.
expiryTime - Message expiry time.
String queueName = "MyQueue"; String message = "I connect with App42 API"; long expiryTime = 10000; Queue queue = queueService.sendMessage(queueName,message, expiryTime); System.out.println("queueName is "+ queue.getQueueName()); System.out.println("queueType is "+ queue.getQueueType()); String jsonResponse = queue.toString();public class Callback : App42Callback { String queueName = "MyQueue"; String message = "I connect with App42 API"; long expiryTime = 10000; queueService.SendMessage(queueName, message, expiryTime,this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Queue queue = (Queue) response; Console.WriteLine("queueName is "+ queue.getQueueName()); Console.WriteLine("queueType is "+ queue.getQueueType()); String jsonResponse = queue.ToString(); } }NSString *queueName = @"MyQueue"; NSString *message = @"I connect with App42 API"; long expiryTime = 10000; Queue *queue = [queueService sendMessage:queueName message:message expiryTime:expiryTime]; NSLog(@"queueName is = %@",queue.queueName); NSLog(@"queueType is= %@",queue.queueType); NSString *jsonResponse = [queue toString];String queueName = "MyQueue"; String message = "I connect with App42 API"; long expiryTime = 10000; Queue queue = queueService.sendMessage(queueName,message, expiryTime); System.out.println("queueName is "+ queue.getQueueName()); System.out.println("queueType is "+ queue.getQueueType()); String jsonResponse = queue.toString();String queueName = "MyQueue"; String message = "I connect with App42 API"; long expiryTime = 10000; Queue queue = queueService.sendMessage(queueName,message, expiryTime); System.out.println("queueName is "+ queue.getQueueName()); System.out.println("queueType is "+ queue.getQueueType()); String jsonResponse = queue.toString();Coming SoonNot AvailableString queueName = "MyQueue"; String message = "I connect with App42 API"; long expiryTime = 10000; Queue queue = queueService.SendMessage(queueName,message, expiryTime); Console.WriteLine("queueName is "+ queue.getQueueName()); Console.WriteLine("queueType is "+ queue.getQueueType()); String jsonResponse = queue.toString();$queueName = "MyQueue"; $message = "I connect with App42 API"; $expiryTime = 10000; $queue = $queueService->sendMessage($queueName,$message, $expiryTime); print_r("queueName is" . $queue->getQueueName()); print_r("queueType is" . $queue->getQueueType()); $jsonResponse = $queue->toString();Coming Soonqueue_name = "MyQueue"; msg = "Its a Real Message"; exp = 100000; 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 "messageId is #{message.message_id}"; puts "payLoad is #{message.pay_load}"; end json_response = queue.to_s();Coming SoonComing Soon
Pull all the message from the queue.
Required Parameters
queueName - The name of the queue from which messages have to be pulled.
receiveTimeOut - Receive time out (in milli seconds).
String queueName = "MyQueue"; long receiveTimeOut = 10000; Queue queue = queueService.receiveMessage(queueName, receiveTimeOut); System.out.println("queueName is "+ queue.getQueueName()); System.out.println("queueType is "+ queue.getQueueType()); String jsonResponse = queue.toString();public class Callback : App42Callback { String queueName = "MyQueue"; long receiveTimeOut = 10000; queueService.ReceiveMessage(queueName, receiveTimeOut,this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Queue queue = (Queue) response; Console.WriteLine("queueName is "+ queue.getQueueName()); Console.WriteLine("queueType is "+ queue.getQueueType()); String jsonResponse = queue.ToString(); } }NSString *queueName = @"MyQueue"; long receiveTimeOut = 10000; Queue *queue = [queueService receiveMessage:queueName receiveTimeOut:receiveTimeOut]; NSLog(@"queueName is = %@",queue.queueName); NSLog(@"queueType is= %@",queue.queueType); NSString *jsonResponse = [queue toString];String queueName = "MyQueue"; long receiveTimeOut = 10000; Queue queue = queueService.receiveMessage(queueName, receiveTimeOut); System.out.println("queueName is "+ queue.getQueueName()); System.out.println("queueType is "+ queue.getQueueType()); String jsonResponse = queue.toString();String queueName = "MyQueue"; long receiveTimeOut = 10000; Queue queue = queueService.receiveMessage(queueName, receiveTimeOut); System.out.println("queueName is "+ queue.getQueueName()); System.out.println("queueType is "+ queue.getQueueType()); String jsonResponse = queue.toString();Coming SoonNot AvailableString queueName = "MyQueue"; long receiveTimeOut = 10000; Queue queue = queueService.ReceiveMessage(queueName, receiveTimeOut); Console.WriteLine("queueName is "+ queue.getQueueName()); Console.WriteLine("queueType is "+ queue.getQueueType()); String jsonResponse = queue.toString();$queueName = "MyQueue"; $receiveTimeOut = 10000; $queue = $queueService->receiveMessage($queueName, $receiveTimeOut); print_r("queueName is" . $queue->getQueueName()); print_r("queueType is" . $queue->getQueueType()); $jsonResponse = $queue->toString();Coming Soonqueue_name ="MyQueue"; receive_time_out = 10000; 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();Coming SoonComing Soon
Pull message based on the correlation id.
Required Parameters
queueName - The name of the queue from which messages have to be pulled.
receiveTimeOut - Receive time out (in milli seconds).
correlationId - Correlation Id for which message has to be pulled.
String queueName = "MyQueue"; long receiveTimeOut = 10000; String correlationId = "Correlation Id"; Queue queue = queueService.receiveMessageByCorrelationId(queueName, receiveTimeOut,correlationId); System.out.println("queueName is "+ queue.getQueueName()); System.out.println("queueType is "+ queue.getQueueType()); String jsonResponse = queue.toString();public class Callback : App42Callback { String queueName = "MyQueue"; long receiveTimeOut = 10000; String correlationId = "Correlation Id"; queueService.ReceiveMessageByCorrelationId(queueName, receiveTimeOut,correlationId,this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Queue queue = (Queue) response; Console.WriteLine("queueName is "+ queue.getQueueName()); Console.WriteLine("queueType is "+ queue.getQueueType()); String jsonResponse = queue.ToString(); } }NSString *queueName = @"MyQueue"; long receiveTimeOut = 10000; NSString *correlationId = @"Correlation Id"; Queue *queue = [queueService receiveMessageByCorrelationId:queueName receiveTimeOut:receiveTimeOut correlationId:correlationId]; NSLog(@"queueName is = %@",queue.queueName); NSLog(@"queueType is= %@",queue.queueType); NSString *jsonResponse = [queue toString];String queueName = "MyQueue"; long receiveTimeOut = 10000; String correlationId = "Correlation Id"; Queue queue = queueService.receiveMessageByCorrelationId(queueName, receiveTimeOut,correlationId); System.out.println("queueName is "+ queue.getQueueName()); System.out.println("queueType is "+ queue.getQueueType()); String jsonResponse = queue.toString();String queueName = "MyQueue"; long receiveTimeOut = 10000; String correlationId = "Correlation Id"; Queue queue = queueService.receiveMessageByCorrelationId(queueName, receiveTimeOut,correlationId); System.out.println("queueName is "+ queue.getQueueName()); System.out.println("queueType is "+ queue.getQueueType()); String jsonResponse = queue.toString();Coming SoonNot AvailableString queueName = "MyQueue"; long receiveTimeOut = 10000; String correlationId = "Correlation Id"; Queue queue = queueService.ReceiveMessageByCorrelationId(queueName, receiveTimeOut,correlationId); Console.WriteLine("queueName is "+ queue.getQueueName()); Console.WriteLine("queueType is "+ queue.getQueueType()); String jsonResponse = queue.toString();$queueName = "MyQueue"; $receiveTimeOut = 10000; $correlationId = "Correlation Id"; $queue = $queueService->receiveMessageByCorrelationId($queueName, $receiveTimeOut,$correlationId); print_r("queueName is" . $queue->getQueueName()); print_r("queueType is" . $queue->getQueueType()); $jsonResponse = $queue->toString();Coming Soonqueue_name = "MyQueue"; receive_time_out = 10000; correlation_id = "App42_d929f477-3517-4131-a46d-c2826b701f8d"; 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();Coming SoonComing Soon
Remove message 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 message id of the message which has to be removed.
String queueName = "MyQueue"; String messageId = "Message Id"; App42Response response = queueService.removeMessage(queueName,messageId); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();public class Callback : App42Callback { String queueName = "MyQueue"; String messageId = "Message Id"; queueService.RemoveMessage(queueName,messageId,this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { App42Response success = (App42Response) response; String jsonResponse = success.ToString(); } }NSString *queueName = @"MyQueue"; NSString *messageId = @"Message Id"; App42Response *response = [queueService removeMessage:queueName messageId:messageId]; NSString *success = response.isResponseSuccess; NSString *jsonResponse = [response toString];String queueName = "MyQueue"; String messageId = "Message Id"; App42Response response = queueService.removeMessage(queueName,messageId); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();String queueName = "MyQueue"; String messageId = "Message Id"; App42Response response = queueService.removeMessage(queueName,messageId); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();Coming SoonNot AvailableString queueName = "MyQueue"; String messageId = "Message Id"; App42Response response = queueService.RemoveMessage(queueName,messageId); Boolean success = response.IsResponseSuccess(); String jsonResponse = response.ToString();$queueName = "MyQueue"; $messageId = "Message Id"; $response = $queueService->removeMessage($queueName,$messageId); $success = $respons->isResponseSuccess(); $jsonResponse = $respons->toString();Coming Soonqueue_name = "MyQueue"; message_id = "ID:SHEPHERTZ-59712-1336725186689-0:30:24:1:1"; response = queue_service.remove_message(queue_name, message_id); success = response.is_response_success(); json_response = response.to_s()Coming SoonComing Soon
Deletes the Pull type Queue.
Required Parameters
queueName - The name of the queue which has to be deleted.
String queueName = "MyQueue"; App42Response response = queueService.deletePullQueue(queueName); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();public class Callback : App42Callback { String queueName = "MyQueue"; queueService.DeletePullQueue(queueName,this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { App42Response success = (App42Response) response; String jsonResponse = success.ToString(); } }NSString *queueName = @"MyQueue"; App42Response *response = [queueService deletePullQueue:queueName]; NSString *success = response.isResponseSuccess; NSString *jsonResponse = [response toString];String queueName = "MyQueue"; App42Response response = queueService.deletePullQueue(queueName); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();String queueName = "MyQueue"; App42Response response = queueService.deletePullQueue(queueName); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();Coming SoonNot AvailableString queueName = "MyQueue"; App42Response response = queueService.DeletePullQueue(queueName); Boolean success = response.IsResponseSuccess(); String jsonResponse = response.ToString();$queueName = "MyQueue"; $response = $queueService->deletePullQueue($queueName); $success = $respons->isResponseSuccess(); $jsonResponse = $respons->toString();Coming Soonqueue_name = "MyQueue"; response = queue_service.delete_pull_queue(queue_name); success = response.is_response_success(); json_response = response.to_s();Coming SoonComing Soon
The functions available under Message/Queue API can throw some exceptions in abnormal conditions. Example of the same has been given below. E.g. If App 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 = "Its a Real Message"; long exp = 100000; 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(); }public class Callback : App42Callback { String queueName = "MyQueue"; String msg = "Its a Real Message"; long exp = 100000; queueService.SendMessage(queueName, msg, exp, this); void App42Callback.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(); } void App42Callback.OnSuccess(Object response) { Queue queue = (Queue) response; String jsonResponse = queue.ToString(); } }NSString *queueName = @"MyQueue"; NSString *msg = @"Its a Real Message"; long exp = 100000; @try{ Queue *queue = [queueService sendMessage:queueName message:msg expiryTime:exp]; } @catch(App42Exception *ex) { int appErrorCode = ex.appErrorCode; int httpErrorCode = ex.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; }String queueName = "MyQueue"; String msg = "Its a Real Message"; long exp = 100000; 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 = "Its a Real Message"; long exp = 100000; 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(); }Coming SoonNot AvailableString queueName = "MyQueue"; String msg = "Its a Real Message"; long exp = 100000; 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 = "Its a Real Message"; $exp = 100000; 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 Soon
Functions in Message API might throw exceptions with following HTTP and Application Error Codes (along with their descriptions):
1400 - BAD REQUEST - The Request 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.