-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4674 from Nadeeshan96/master-fix-runtime-bbes
Improve `StopHandler` BBE
- Loading branch information
Showing
3 changed files
with
11 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
# Invoke the service using cURL to add a fruit item. | ||
$ curl http://localhost:9090/addToBasket -d 'Guava' | ||
["Apple", "Orange", "Guava"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
# `StopHandler` | ||
|
||
The `StopHandler` registers a function that will be called during the graceful shutdown. | ||
This example demonstrates how to register a function that will be executed at the end of the program. | ||
A `StopHandler` is a function that is registered at runtime with a module and invoked during graceful shutdown. | ||
This example demonstrates how to register a `StopHandler` that will be executed at the end of the program. | ||
|
||
::: code stop_handler.bal ::: | ||
|
||
::: out stop_handler.client.out ::: | ||
Navigate to the directory that contains the 'stop_handler.bal' file, and run the 'bal run' command. | ||
|
||
::: out stop_handler.server.out ::: | ||
|
||
Invoke the service by executing the following cURL command in a new terminal to add a fruit item. | ||
|
||
::: out stop_handler.client.out ::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
# Navigate to the directory that contains the | ||
# 'stop_handler.bal' file, and run the 'bal run' command below. | ||
|
||
$ bal run stop_handler.bal | ||
|
||
# Send the interrupt signal SIGINT to terminate the current process. | ||
Ctrl+c | ||
initial items in fruit basket: ["Apple","Orange"] | ||
|
||
# Invoke the service using cURL command as mentioned below in a new terminal. | ||
after adding a fruit item: ["Apple","Orange","Guava"] | ||
|
||
# Send the interrupt signal SIGINT (Ctrl+C) to terminate the current process. | ||
after removing all fruit items: [] |