Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit e6d29df

Browse files
Em processo de correção de envio de sample para a fila
1 parent 60ad3f0 commit e6d29df

File tree

4 files changed

+94
-6
lines changed

4 files changed

+94
-6
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"sample": "json"
3+
}

examples/lambda_api/scripts/localstack/sqs/send-message.sh

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,43 @@
1+
# -----------------------------------------------------------------------------
2+
# Current file variables
3+
# -----------------------------------------------------------------------------
4+
debug=true
5+
parent_folder="../"
6+
current_path=$(pwd)/
7+
current_path_basename=$(basename $(pwd))
8+
current_file_full_path=$0
9+
current_file_name=$(basename -- "$0")
10+
if [ $current_file_full_path = $current_file_name ] || [ $current_file_full_path = "./$current_file_name" ]; then
11+
current_file_full_path="./${current_file_full_path}"
12+
current_file_path="./"
13+
else
14+
current_file_path="${current_file_full_path/$current_file_name/''}"
15+
fi
16+
17+
current_file_path_basename=$(basename -- "$current_file_path")
18+
19+
if [ -z "$current_file_path_basename" ] || [ $current_file_path = "./" ]; then
20+
current_parent_folder="../"
21+
else
22+
current_file_path_basename=$current_file_path_basename/
23+
# TODO: está com problema (corrigir)
24+
current_parent_folder="${current_file_path/$current_file_path_basename/''}"
25+
fi
26+
27+
28+
if [ debug ]; then
29+
echo '----------------------------------------'
30+
echo "$0 - Script variables"
31+
echo '----------------------------------------'
32+
echo "current_path: $current_path"
33+
echo "current_path_basename: $current_path_basename"
34+
echo "current_file_full_path: $current_file_full_path"
35+
echo "current_file_name: $current_file_name"
36+
echo "current_file_path: $current_file_path"
37+
echo "current_parent_folder: $current_parent_folder"
38+
echo '----------------------------------------'
39+
fi
40+
141
QUEUE=$1
242
if [ -z "$QUEUE" ]
343
then
@@ -9,9 +49,10 @@ fi
949
MESSAGE=$2
1050
if [ -z "$MESSAGE" ]
1151
then
12-
MESSAGE=$(cat samples/localstack/sqs/sample.json)
52+
MESSAGE=$(cat ${current_file_path}sample.json)
1353
fi
14-
#echo $QUEUE
15-
#exit
54+
55+
# cat ${current_file_path}sample.json
56+
# echo $MESSAGE
1657
echo "aws --endpoint-url=http://localhost:4566 sqs send-message --queue-url $QUEUE --message-body '$MESSAGE'"
1758
aws --endpoint-url=http://localhost:4566 sqs send-message --queue-url $QUEUE --message-body "'$MESSAGE'"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"sample": "json"
3+
}

examples/lambda_sqs/scripts/localstack/sqs/send-message.sh

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,43 @@
1+
# -----------------------------------------------------------------------------
2+
# Current file variables
3+
# -----------------------------------------------------------------------------
4+
debug=true
5+
parent_folder="../"
6+
current_path=$(pwd)/
7+
current_path_basename=$(basename $(pwd))
8+
current_file_full_path=$0
9+
current_file_name=$(basename -- "$0")
10+
if [ $current_file_full_path = $current_file_name ] || [ $current_file_full_path = "./$current_file_name" ]; then
11+
current_file_full_path="./${current_file_full_path}"
12+
current_file_path="./"
13+
else
14+
current_file_path="${current_file_full_path/$current_file_name/''}"
15+
fi
16+
17+
current_file_path_basename=$(basename -- "$current_file_path")
18+
19+
if [ -z "$current_file_path_basename" ] || [ $current_file_path = "./" ]; then
20+
current_parent_folder="../"
21+
else
22+
current_file_path_basename=$current_file_path_basename/
23+
# TODO: está com problema (corrigir)
24+
current_parent_folder="${current_file_path/$current_file_path_basename/''}"
25+
fi
26+
27+
28+
if [ debug ]; then
29+
echo '----------------------------------------'
30+
echo "$0 - Script variables"
31+
echo '----------------------------------------'
32+
echo "current_path: $current_path"
33+
echo "current_path_basename: $current_path_basename"
34+
echo "current_file_full_path: $current_file_full_path"
35+
echo "current_file_name: $current_file_name"
36+
echo "current_file_path: $current_file_path"
37+
echo "current_parent_folder: $current_parent_folder"
38+
echo '----------------------------------------'
39+
fi
40+
141
QUEUE=$1
242
if [ -z "$QUEUE" ]
343
then
@@ -9,9 +49,10 @@ fi
949
MESSAGE=$2
1050
if [ -z "$MESSAGE" ]
1151
then
12-
MESSAGE=$(cat samples/localstack/sqs/sample.json)
52+
MESSAGE=$(cat ${current_file_path}sample.json)
1353
fi
14-
#echo $QUEUE
15-
#exit
54+
55+
# cat ${current_file_path}sample.json
56+
# echo $MESSAGE
1657
echo "aws --endpoint-url=http://localhost:4566 sqs send-message --queue-url $QUEUE --message-body '$MESSAGE'"
1758
aws --endpoint-url=http://localhost:4566 sqs send-message --queue-url $QUEUE --message-body "'$MESSAGE'"

0 commit comments

Comments
 (0)