REST-style Actionscript programming interface  for message distribution using Amazon Simple                  Queue Service...
II.      RELATED WORK                           III.    AMAZON SQS APPLICATION PROGRAMMING    As of recent, software devel...
concerns must be taken into consideration during               deleteMessage - remove a previously received         the o...
mandatory parameters are checked if they are properly   formatted, if not exception will be thrown.   Usage of these three...
cloud message queue enabled mobile application on                         [7]    Microsoft Azure Message Queue, Queue Serv...
Upcoming SlideShare
Loading in …5
×

REST-style Actionscript programming interface for message distribution using Amazon Simple Queue Service

4,230 views
4,177 views

Published on

Amazon Simple Queue Service (Amazon SQS) is a message-oriented middleware in the cloud using software as a service model. It aims to eliminate the traditional overhead associated with operating in-house messaging infrastructures by providing reduced costs, simplified access to messaging resources, scalability and reliability. In order to provide those benefits Amazon SQS leverages cloud resources such as storage, network, memory, processing capacity. Using virtually unlimited cloud computing resources, an Amazon SQS provides an internet scale messaging platform. This paper presents benefits and examples of Amazon SQS programming interface developed in Actionscript 3.0 object-oriented programming language. This interface was developed to enable Adobe Flex mobile developers to facilitate integration efforts within organizations and between them using mobile devices (tablets and smartphones).

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
4,230
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

REST-style Actionscript programming interface for message distribution using Amazon Simple Queue Service

  1. 1. REST-style Actionscript programming interface for message distribution using Amazon Simple Queue Service K. Popovic, Z. Hocenski Siemens d.d. / Communications, Media and Technology, Osijek, Croatia Faculty of Electrical Engineering / Institute of Automation and Process Computing, Osijek, Croatia kresimir.popovic@siemens.comAbstract - Amazon Simple Queue Service (Amazon SQS) is counterpart. In this model organizations are onlya message-oriented middleware in the cloud using software responsible for deploying the portion of the applicationsas a service model. It aims to eliminate the traditional that interact with the web services and message queues.overhead associated with operating in-house messaginginfrastructures by providing reduced costs, simplified access Message and data exchange are an essential aspect ofto messaging resources, scalability and reliability. In order any enterprise mobile application [3]. The ability toto provide those benefits Amazon SQS leverages cloud exchange messages or consume data from on-premise orresources such as storage, network, memory, processing cloud environments in a mobile device is, arguably, thecapacity. Using virtually unlimited cloud computing most relevant element of an enterprise mobility platform.resources, an Amazon SQS provides an internet scale The key is to build components that do not have tightmessaging platform. This paper presents benefits and dependencies on each other, so that if one componentexamples of Amazon SQS programming interface developed were to die (fail), sleep (not respond) or remain busyin Actionscript 3.0 object-oriented programming language. (slow to respond) for some reason, the other componentsThis interface was developed to enable Adobe Flex mobile in the system are built so as to continue to work as if nodevelopers to facilitate integration efforts within failure is happening. In essence, loose coupling isolatesorganizations and between them using mobile devices the various layers and components so that each component(tablets and smartphones). interacts asynchronously with the others and treats them as a black box. Loosely coupled system can be build I. INTRODUCTION using messaging queues. If a queue is used to connect any two components together, it can provide concurrency, Mobile computing has drastically impacted the social high availability and mitigate load spikes.and commercial aspects of our society [1]. Seeing theexplosion of mobile applications in the consumer world, Today, technologies such as Amazon SQS [4],companies cant avoid dreaming about revolutionizing CloudMQ [5], Linxter [6], Microsoft Azure Messagetheir businesses with the presence of mobile applications. Queue [7] and others offer simple cloud-based messagingThe ability of extending business capabilities to mobile services to broker the communication between differentdevices (tablets and smartphones) leads the priority list of endpoints. In this paper benefits and examples of Amazonmost CIOs (Chief Information Officer) [2]. However, the SQS programming interface developed in Actionscript 3.0path to enterprise mobility goes beyond building sporadic object-oriented programming language (library name:applications for a specific line of business systems. as3awsSDK.swc) are presented [8]. Interface is developedCompanies embarking on the enterprise mobility journey as publicly available Community Contributed Softwareneed cohesive strategies for important mobile for thin clients [9].infrastructure aspects such as device management, The goal of this paper is to present developed Amazonidentity, security, and monitoring, that are required to SQS programming application interface for Actionscriptprovide a true enterprise mobility experience. During the 3.0 and its benefits for Flex developer community.last few years, cloud infrastructures have pushed thefrontiers of software development to areas never before The paper is organized as follows: Section II listsimagined. In the context of enterprise mobility, the cloud recent available software development kits frommodel and services present a unique model to simplify the prominent cloud providers and open-source community.challenges of the traditional enterprise mobility model and Also benefits of Amazon Simple Queue Service (Amazonto open new possibilities in the space. Conceptually, an SQS) are considered, and mobile application portabilityenterprise cloud mobility platform removes the issue solution is recommended. Section III presentscomplexities of the mobile enterprise server from the architecture of Amazon SQS API for Actionscript 3.0 andcorporate network by placing it in a cloud infrastructure one use case sample how it can be used in practice.where it can leverage various cloud services to enable itsnative capabilities. A cloud enterprise mobilityinfrastructure represents a higher simpler model from theinfrastructure standpoint than its on-premise
  2. 2. II. RELATED WORK III. AMAZON SQS APPLICATION PROGRAMMING As of recent, software development kits available INTERFACE FOR ACTIONSCRIPT 3.0from prominent cloud providers and open-source Amazon SQS is used as message-passing mechanismcommunity provide APIs (libraries) that hide much of the between components. It acts as glue that holds togetherlower-level complexity, including authentication, request different functional components. This not only helps inretries, and error handling. They take the complexity out making the different components loosely coupled, butof coding directly against a web service interface. TABLE also helps in building a more failure resilient systemI shows available software development kits from overall. If one component is receiving and processingdifferent cloud providers. requests faster than other components (an unbalanced producer consumer situation), buffering will help make the overall system more resilient to bursts of traffic (or TABLE I. SOFTWARE DEVELOPMENT KITS load). Amazon SQS acts as a transient buffer between Software Cloud provider two or more components (controllers). If a message is Development sent directly to a component, the receiver will need to Kit Microsoft Linxter CloudMQ Amazon consume it at a rate dictated by the sender. For example, Home computer if the system was slow or if the launch time of the cluster was more than expected, the overall system would slow Java down, as it would just have to wait. With message queues, sender and receiver are decoupled and the queue .NET service smoothens out any “spiky” message traffic. These service benefits can be used by mobile devices in an PHP innovative, simple and transparent way. Ruby A. Characteristics of a good API Mobile What are characteristics of a good application programming interface (API)? Answer to this question iOS has to be known to software developers before API implementation. Android  Easy to learn (steeper learning curve) - an easy-to- BlackBerry learn API features, consistent naming conventions and patterns, economy of concepts, and predictability. It uses the same name for the same Each provider provides several publicly available concept, and different names for differentlibraries for different development environments. For concepts. A minimal API is easy to memorizeproper use developer needs to have technical knowledge because there is little to remember. A consistentabout the environment in which he/she develops. This can API is easy to memorize because you can reapplybe time consuming and costly because e.g. for mobile what you learned in one part of the API whendevelopment it is necessary to have iOS, BlackBerry and using a different part. The semantics should beAndroid knowledge. Also, the same application needs to simple and clear, and follow the principle of leastbe developed three times. Solution to the portability issue surprise.is to use technology which enables developers to write  Hard to misuse - A well-designed API makes itcode once, and run anywhere. This is possible since June, easier to write correct code than incorrect code,2011 using Adobe Flex SDK (version 4.5 or later) and encourages good programming practices. Itframework [10]. Flex is a highly productive, open source does not needlessly force the user to call methodsframework for building and maintaining expressive web in a strict order or to be aware of implicit sideapplications that deploy consistently on all major effects or semantic oddities.browsers, desktops and operating systems. This meansthat source code written in Actionscript 3.0 can be also  Easy to read and maintain code that uses it -compiled for all mobile devices. Knowing that, it was readable code can be concise or verbose. Eitherprudent to develop an Actionscript 3.0 library for one of way, it is always at the right level of abstraction—cloud providers which offer message queue service. neither hiding important things nor forcing thePurpose of this library is to enable Adobe Flex developers software developer to specify irrelevantto facilitate integration efforts within organizations and information.between them using mobile devices. The benefit of doingit this way has impact on application maintenance costs.  Easy to extend - Libraries grow over time. NewAmazon SQS owned by Amazon Inc. was chosen as classes appear. Existing classes get new methods,message middleware because of proven maturity when methods get new parameters, and enums get newcompared to others and due to Amazon’s vast cloud enum values. APIs should be designed with this inmarket share. mind. The larger the API, the more likely the clashes between the new concepts and the existing concepts. In addition, binary compatibility
  3. 3. concerns must be taken into consideration during  deleteMessage - remove a previously received the original design phase. message from a specified queue. Guidance above was taken as main beacon toward  deleteMessageBatch - remove multiple previously good API during the design and development phase of received messages from a specified queue. Amazon SQS API for Actionscript 3.0. After development phase it was shown that developers  setQueueAttributes - control queue settings like should strive for minimalism and consistency, but only the amount of time that messages are locked after to the extent that they contribute to meeting the criteria being read so they cannot be read again. listed above. Consistency coincides broadly with  getQueueAttributes - get information about a conceptual integrity, the principle that a complex queue like the number of messages in it. system should have a coherent design, reflecting the vision of one architect.  getQueueUrl - get the queue URL.Quote from F.P. Brooks [11]: „I contend that conceptual  addPermission - add queue sharing for anotherintegrity is the most important consideration in system AWS account for a specified queue.design. It is better to have a system omit certain  removePermission - remove an Amazon AWSanomalous features and improvements, but to reflect one account from queue sharing for a specified queue.set of design ideas, than to have one that contains manygood but independent and uncoordinated ideas.“  releaseResources – this is a special function which removes all event listeners and releases anyB. Architecture of developed Amazon SQS API for resources that might be held open on client side. Actionscript 3.0 – as3awsSDK.swc Execution of this method minimizes memory Amazon SQS library for Actionscript 3.0 consumption.as3awsSDK.swc is consisted of three basic model types:event model, interface model and class model. Interface Class model contains two core classes:model employs a simple interface  com.amazonaws.AmazonWebServiceClient –com.amazonaws.services.sqs.AmazonSQS (defined in abstract class which performs data streamAmazon SQS WSDL version 2011-10-01) that is easy to encoding using createURLRequest protecteduse and extend (see Figure 1). function. It is designed as a base class which can be reused by other Amazon AWS services, e.g. Amazon Cloudwatch monitoring service [12], DynamoDB noSQL database [13], etc.  com.amazonaws.services.sqs.AmazonSQSClient – queue client which contains implemented and documented asynchronous queue service public functions. Each function is unique and there is no dependence between each other. Event model uses interface Figure 1. Basic architecture overview of Amazon SQS API for flash.events.IEventDispatcher. The IEventDispatcher Actionscript 3.0 interface defines methods for adding or removing event listeners, checks whether specific types of event The following AmazonSQSClient requests defined by listeners are registered, and dispatches events. Eventinterface AmazonSQS are provided: targets are an important part of the Flash® Player and Adobe AIR event model. The event target serves as  createQueue - create queues for use with your the focal point for how events flow through the display Amazon AWS account. list hierarchy. When an HTTP/HTTPS COMPLETE  listQueues - list your existing queues. event occurs, an event object is dispatched into the event flow from the root of the display list. The event  deleteQueue - delete one of your queues. object makes a round-trip journey to the event target, which is conceptually divided into three phases: the  sendMessage - add messages to a specified queue. capture phase includes the journey from the root to the  sendMessageBatch - add multiple messages to a last node before the event targets node; the target specified queue. phase includes only the event target node; and the bubbling phase includes any subsequent nodes  receiveMessage - return one or more messages encountered on the return trip to the root of the display from a specified queue. list.  changeMessageVisibility - change the visibility HTTP(s) request responses in XML format are timeout of previously received message. caught by an event model, parsed and deserialized to  changeMessageVisibilityBatch - change the Actionscript 3.0 result object for easier user handling. visibility timeout of multiple previously received During XML namespace parsing, response format and messages.
  4. 4. mandatory parameters are checked if they are properly formatted, if not exception will be thrown. Usage of these three models guarantees consistency in future Amazon SQS API library upgrades. This means that Amazon SQS API can be used as a template for creation of new services in the future.C. How to use Amazon SQS API for Actionscript 3.0 For proper programmatic usage it is necessary tounderstand that API only works in asynchronousenvironment because it is based on Adobe Flash and Figure 3. Taxi reservation serviceAdobe AIR technology. Every request (sendMessagefunction, see Figure 2) has assigned two callback Use case description:functions called when a specific event occurs.  iPhone / Android / BlackBerry user opens Taxi reservation mobile application.  User enters his first name, last name, pickup location, dropdown location, number of people and a phone number.  Reservation request is send towards Amazon SQS queue TAXI_RESERVATION and stored there until service consumer (e.g. harvest server) pick it up.  Harvest server checks every e.g. 30 seconds TAXI_RESERVATION queue status and harvests messages if there are any. When the message is consumed from queue it needs to be processed and stored into a database. After the message is consumed it needs to be deleted from the TAXI_RESERVATION queue.  If a user reservation request can be served (taxi car is available) dispatcher will call the user and confirm reservation or send an SMS / e-mail. The advantage of working with queues is that if the harvest server is offline reservation records can be consumed later after harvest server comes back Figure 2. Amazon SQS sendMessage sample for Actionscript 3.0 online. With this degree of independence, taxi software components are protected from each other and can better ResultHandler function is called when positive HTTP/ recover from component failure. If the SOA (ServiceHTTPS response event occurs (result code 200 OK) and Oriented Architecture) is designed correctly, the failurethe faultHandler for negative event (result code >= 400). of a single component should not take down otherOther functions defined in interface components in the system and thus loose coupling createscom.amazonaws.services.sqs.AmazonSQS are used in the architectures that are more resilient. Moreover, this alsosimilar way. This means that developers will have a steep lends itself better to creating a failover subsystem,learning curve and become quite proficient in API usage moving from one instance of a component to anotherwith a minimum amount of effort/time. without affecting the other components in the SOA.D. Taxi reservation service – usecase sample IV. CONLUSION One of possible usage of mobile device and custom In this paper Amazon Simple Queue Service (Amazondeveloped as3awsSDK.swc library is for connecting to SQS) programming application interface for ActionscriptAmazon SQS service to store taxi reservation messages 3.0 (as3awsSDK.swc) has been presented and its benefits(see Figure 3). It can be quite useful when taxi dispatcher for Flex developer community. Most valuable advantagephone lines are busy. The mobile application which does of programming application interface for Actionscript 3.0reservation is portable to all mobile devices because it (compiled with Flex SDK compiler 4.5 or greater) frommust be compiled with Flex compiler for proper library technical point of view is portability. Code compiled withusage. the Flex SDK compiler follows the slogan “write code once, and run anywhere”. It enables developers to deploy
  5. 5. cloud message queue enabled mobile application on [7] Microsoft Azure Message Queue, Queue Service Rest API,several different mobile OS result of which are reduced http://msdn.microsoft.com/en- us/library/windowsazure/dd179363.aspx, February 05, 2012.development costs and time. During the time of writing [8] K. Popovic, Amazon SQS API library (version 1.4.1),this paper library was downloaded by open source https://bitbucket.org/Kresimir/as3awssdk/overview, February 05,community 176 times. 2012. [9] Amazon Inc, Amazon AWS SDK library (actionscript 3.0), REFERENCES Community Contributed Software, http://aws.amazon.com/developertools/0564396818170928, May[1] Gartner, Inc. (information technology research and advisory 03, 2011. company), Gartner Forecasts Mobile App Store Revenues, [10] Adobe Inc. Adobe Open Source Flex SDK compiler, http://techcrunch.com/2011/01/26/mobile-app-store-15-billion- http://opensource.adobe.com/wiki/display/flexsdk/Flex+SDK, 2011/, February 05, 2012. February 05, 2012.[2] Sysbase (an SAP company), Mobile Enterprise Application [11] F.P. Brooks, “The Mythical Man-Month: Essays on Software Platform, http://www.sybase.com/mobilize/strategic-mobility, Engineering”, Second Edition, ISBN-10: 0201835959, ISBN-13: February 05, 2012. 978-0201835953, August 12, 1995.[3] W. R. Schulte, “Cloud-Based Messaging Services and Technology [12] Amazon Inc, Cloudwatch service, Are Positioned for Rapid Growth”, Gartner research paper, http://aws.amazon.com/cloudwatch/, February 05, 2012. January 24, 2011. [13] Amazoin Inc, DynamoDB noSQL database,[4] Amazon Inc., Simple Queue Service, http://aws.amazon.com/sqs/, http://aws.amazon.com/dynamodb/, February 05, 2012. February 05, 2012.[5] CloudMQ, Message Queuing as a Service, http://www.cloudmq.com/, February 05, 2012.[6] Linxter, Message-Orianted Cloud Middleware, http://www.cloudmessaging.net/, February 05, 2012.

×