Professional Cloud Developer · Free Practice Question Hard

Question 24

The task at hand is to create an application that subscribes to and receives messages from a single Pub/Sub topic and inserts corresponding rows into a database. The application runs on Linux and uses preemptible virtual machines to lower expenses. To achieve a graceful shutdown, a shutdown script must be designed.


What steps do you need to take?

  • A Write a shutdown script that broadcasts a message to all signed-in users that the Compute Engine instance is going down and instructs them to save current work and sign out.
  • B Write a shutdown script that uses inter-process signals to notify the application process to disconnect from the database.
  • C Write a shutdown script that publishes a message to the Pub/Sub topic announcing that a shutdown is in progress. After the application reads the message, it disconnects from the database.
  • D Write a shutdown script that writes a file in a location that is being polled by the application once every five minutes. After the file is read, the application disconnects from the database.
Reveal correct answer

Correct answer: B

Explanation

According to the Professional Google Cloud Developer documentation, to initiate a graceful shutdown of an application that subscribes to and receives messages from a single Pub/Sub topic and inserts corresponding rows into a database, a shutdown script should be written that uses inter-process signals to notify the application process to disconnect from the database. This is because shutting down an application abruptly without properly handling ongoing operations can lead to data loss and other issues. By sending inter-process signals, the application can be notified to gracefully terminate ongoing operations and disconnect from any connected resources, such as the database, before shutting down. This ensures data integrity and reduces the risk of errors or corruption.

Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need