Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

AWS: Simple Queue Servi?é sus Message queues provide communication and coordinat

ID: 3738889 • Letter: A

Question

AWS: Simple Queue Servi?é sus Message queues provide communication and coordination for these distributed applications. Message performance, reliability and scalability while improving queues can significantly simplify coding of decoupled applications, SQS Types: I-requests (The message will be stored for 4 days but you can changed up to 14 days) 2- Replies (deleted directly) 3-error messages can handle up to 5 messages a day (reset every day 4-plain information unlimited Message Attribute Items and Validation Each message attribute consists of the following items: Name-The message attribute name can contain the following characters: A-Z, a- z, e-9, underscore ), hyphen(-), and period (.). The name must not start or end with a period, and it should not have successive periods. The name is case- sensitive and must be unique among all attribute names for the message. The name can be up to 256 characters long. The name can't start with ANS. or Amazon. (or any variations in casing) because these prefixes are reserved for use by Amazon Web Services Type-The supported message attribute data types are String, Number, and Binary. You can also provide custom information about the type. The data type has the same restrictions on the content as the message body. The data type is case-sensitive, and it can be up to 256 bytes long Value-The user-specified message attribute value. For string data types, the value attribute has the same restrictions on the content as the message body . . Date . Time month Write a program to print the status of all queues at the end of the month (assuming that the queues were all empty at the beginning of the month),

Explanation / Answer

ANS:-

Required data structure: This problem involves the use of Queue data structure. A Queue is a FIFO (First Come First Serve) data structure. In a queue, a everytime a new item is received, it is added at the end of queue and an existing element will always be removed from the front of the queue. A queue can be implemented either by using an array or by using linked list. A sample implementation of a queue using arrays is given below:

-----------------------------

//Queue class
class Queue {
private:
   int first; //for front element of queue
   int last; //for last element of queue
   int size; //max. size of queue
   int count; //number of elements in queue
   int *storage; //storage for queue elements
public:
   //Constructor
   Queue(int n) {
       first = 0;
       last = -1;
       count = 0;
       size = n;
       storage = new int[size];
   }
   //Checks if queue is full.
   bool is_full() {
       return (count >= size);
   }
   //Checks if queue is empty.
   bool is_empty() {
       return (count == 0);
   }
   //inserts at the end of queue.
   void enqueue(int el) {
       if(!is_full())
       {
           last = (last + 1) % size;
           count++;
           storage[last] = el;
       }
       else
       {
           cerr<<"Overflow"<<endl;
       }
   }
   //removes from front of queue
   int dequeue() {
       if(!is_empty())
       {
           int tmp = storage[first];
           first = (first + 1) % size;
           count--;
           return tmp;
       }
       else
       {
           cerr<<"Underflow"<<endl;
           return NULL;
       }
   }
};

-------------------------------------------

Note: You can modify this class suitably to store messages in place of integers.

Structure of the message: The structure of the message can be specified as follows:

-----------------------------------------------

struct {
   int day;
   int month;
   int year;
} Date;
struct {
   int hours;
   int minutes;
} Time;
struct {
char name[256];
char type[256];
char value[256];
Date date;
Time time;
} Message;

-----------------------------------------------

No. of queues required:

For the problem, 4 SOS types are given. You will need a separate queue for each SOS type

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote