-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
convert output to use heredoc approach
- Loading branch information
1 parent
4cdad8d
commit 3c7c8f1
Showing
16 changed files
with
174 additions
and
62 deletions.
There are no files selected for viewing
16 changes: 12 additions & 4 deletions
16
deployments/tyk/scripts/examples/streams/authenticated-pubsub/authenticated-pubsub-1.sh
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,7 +1,15 @@ | ||
echo "Streams - Authenticated PubSub" | ||
echo "Part 1: Authenticate as a subscriber" | ||
echo "This script connects to a server-sent event endpoint, and waits to receive messages. It authenticates using the Authorization header." | ||
echo "Use script 2 to send messages, then check back here to see them being received." | ||
cat <<EOF | ||
$(printf "\033[1mStreams - Authenticated PubSub\033[0m") | ||
Part 1: Authenticate as a subscriber | ||
This script connects to a server-sent event endpoint, and waits to receive messages. It authenticates using the Authorization header. | ||
Now use script 2 to send messages, then check back here to see them being received. | ||
Waiting for messages... (press Ctrl+C to stop) | ||
EOF | ||
|
||
curl http://tyk-gateway.localhost:8080/streams-authenticated-pubsub/sse \ | ||
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwicG9sIjoiNjZmZmI5OTMyYTRhNTEwMDAxODZkMzc0IiwiaWF0IjoxNTE2MjM5MDIyfQ.G_rM5NWQIQopOZABTLkZEfnp2XSAiN5vFyRZAOWbtFs' |
13 changes: 10 additions & 3 deletions
13
deployments/tyk/scripts/examples/streams/authenticated-pubsub/authenticated-pubsub-2.sh
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
11 changes: 8 additions & 3 deletions
11
deployments/tyk/scripts/examples/streams/authenticated-pubsub/authenticated-pubsub-3.sh
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,6 +1,11 @@ | ||
echo "Streams - Authenticated PubSub" | ||
echo "Part 3: Authentication failure" | ||
echo "This script attempts to send an unauthenticated message to the auth-protected endpoint. This results in the request being rejected." | ||
cat <<EOF | ||
$(printf "\033[1mStreams - Authenticated PubSub\033[0m") | ||
Part 3: Authentication failure | ||
This script attempts to send an unauthenticated message to the auth-protected endpoint. This results in the request being rejected. | ||
EOF | ||
|
||
curl http://tyk-gateway.localhost:8080/streams-authenticated-pubsub/post \ | ||
-d 'Hello, Tyk streams!' |
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
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
15 changes: 11 additions & 4 deletions
15
deployments/tyk/scripts/examples/streams/bidirectional/bidirectional-3.sh
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,5 +1,12 @@ | ||
echo "Streams - Bidirectional" | ||
echo "Part 3: Send a message to 'dev1'" | ||
echo "This part posts data to the stream via Tyk. The data is processed and delivered to the user defined in the querystring." | ||
echo "Check terminals one and two, only the first terminal ('dev1') will have received the message." | ||
cat <<EOF | ||
$(printf "\033[1mStreams - Bidirectional\033[0m") | ||
Part 3: Send a message to 'dev1' | ||
This part posts data to the stream via Tyk. The data is processed and delivered to the user defined in the querystring. | ||
Now check the first and second terminals, only the first terminal ('dev1') will have received the message. | ||
EOF | ||
|
||
curl -X POST http://localhost:8080/streams-bidirectional/event\?user\=dev1 -d '{"foo": "bar"}' |
15 changes: 11 additions & 4 deletions
15
deployments/tyk/scripts/examples/streams/bidirectional/bidirectional-4.sh
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,5 +1,12 @@ | ||
echo "Streams - Bidirectional" | ||
echo "Part 4: Send a message to 'dev2'" | ||
echo "Same as part 3, but message is sent to 'dev2'" | ||
echo "Check terminals one and two, only the second terminal ('dev2') will have received the message." | ||
cat <<EOF | ||
$(printf "\033[1mStreams - Bidirectional\033[0m") | ||
Part 4: Send a message to 'dev2' | ||
Same as part 3, but message is sent to 'dev2' | ||
Now check the first and second terminals, only the second terminal ('dev2') will have received the message. | ||
EOF | ||
|
||
curl -X POST http://localhost:8080/streams-bidirectional/event\?user\=dev2 -d '{"Tyk": "Streams"}' |
17 changes: 12 additions & 5 deletions
17
deployments/tyk/scripts/examples/streams/http-to-amqp/http-to-amqp-1.sh
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,6 +1,13 @@ | ||
echo "Streams - HTTP to AMQP" | ||
echo "Part 1: Listen for messages" | ||
echo "Once connected, run part two of this example in a different terminal. The messages sent by part 2 will appear here." | ||
echo "Tyk enables messages in am AMQP queue to be consumed using server-sent events." | ||
echo "Connecting to the SSE endpoint..." | ||
cat <<EOF | ||
$(printf "\033[1mStreams - HTTP to AMQP\033[0m") | ||
Part 1: Listen for messages | ||
Once connected, run part 2 of this example in a different terminal. The messages sent by part 2 will appear here. | ||
Tyk enables messages in an AMQP queue to be consumed using server-sent events. | ||
Waiting for messages... (Ctrl+C to stop) | ||
EOF | ||
|
||
curl -N http://tyk-gateway.localhost:8080/streams-http-to-amqp/sse |
17 changes: 12 additions & 5 deletions
17
deployments/tyk/scripts/examples/streams/http-to-amqp/http-to-amqp-2.sh
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,6 +1,13 @@ | ||
echo "Streams - HTTP to AMQP" | ||
echo "Part 2: Send a message" | ||
echo "Each time this script is run, the message 'Hello, Tyk Streams!' is sent via the message broker, RabbitMQ." | ||
echo "Tyk converts the HTTP POST request into an AMQP publish message, which is then placed in the RabbitMQ message queue." | ||
echo "Check part 1 to see that the message is received." | ||
cat <<EOF | ||
$(printf "\033[1mStreams - HTTP to AMQP\033[0m") | ||
Part 2: Send a message | ||
Each time this script is run, the message 'Hello, Tyk Streams!' is sent via the message broker, RabbitMQ. | ||
Tyk converts the HTTP POST request into an AMQP publish message, which is then placed in the RabbitMQ message queue. | ||
Now check the first terminal to see that the message is received. | ||
EOF | ||
|
||
curl -X POST http://tyk-gateway.localhost:8080/streams-http-to-amqp/post -d '{"message": "Hello, Tyk Streams!"}' -H "Content-Type: application/json" |
17 changes: 13 additions & 4 deletions
17
deployments/tyk/scripts/examples/streams/http-to-kafka/http-to-kafka-topic-1.sh
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,5 +1,14 @@ | ||
echo "Streams - HTTP to Kakfa" | ||
echo "Part 1: Consume a Kafka topic via the Kafka console consumer" | ||
echo "This example connects to the 'tyk-streams-example' Kafka topic directly using the standard Kafka console consumer." | ||
echo "Now run part two in a different terminal, to connect to Kafka using Tyk Streams." | ||
cat <<EOF | ||
$(printf "\033[1mStreams - HTTP to Kakfa\033[0m") | ||
Part 1: Consume a Kafka topic via the Kafka console consumer | ||
This example connects to the 'tyk-streams-example' Kafka topic directly using the standard Kafka console consumer. | ||
Now run part 2 in a different terminal, to connect to Kafka using Tyk Streams. | ||
Waiting for messages... (Ctrl+C to stop) | ||
EOF | ||
|
||
docker exec -it tyk-demo-kafka-1 /opt/kafka/bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic tyk-streams-example --from-beginning |
17 changes: 13 additions & 4 deletions
17
deployments/tyk/scripts/examples/streams/http-to-kafka/http-to-kafka-topic-2.sh
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,5 +1,14 @@ | ||
echo "Streams - HTTP to Kakfa" | ||
echo "Part 2: Consumer a Kafka topic via Tyk Streams server sent events" | ||
echo "This example connects to Kafka via a Tyk Streams endpoint, which delivers the messages via server-sent events." | ||
echo "Now run part three of this example in a different terminal, to see the message appear here." | ||
cat <<EOF | ||
$(printf "\033[1mStreams - HTTP to Kakfa\033[0m") | ||
Part 2: Consumer a Kafka topic via Tyk Streams server sent events | ||
This example connects to Kafka via a Tyk Streams endpoint, which delivers the messages via server-sent events. | ||
Now run part 3 of this example in a different terminal, to see the message appear here. | ||
Waiting for messages... (Ctrl+C to stop) | ||
EOF | ||
|
||
curl http://tyk-gateway.localhost:8080/streams-http-to-kafka/sub |
15 changes: 11 additions & 4 deletions
15
deployments/tyk/scripts/examples/streams/http-to-kafka/http-to-kafka-topic-3.sh
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,5 +1,12 @@ | ||
echo "Streams - HTTP to Kakfa" | ||
echo "Part 3: Send messages to the Kafka topic via HTTP" | ||
echo "This sends a messages to the 'tyk-streams-example' Kafka topic via an HTTP request that is handled by Tyk." | ||
echo "Now check the first and second terminals to see that the message 'Hello, Tyk Streams!' has appeared." | ||
cat <<EOF | ||
$(printf "\033[1mStreams - HTTP to Kakfa\033[0m") | ||
Part 3: Send messages to the Kafka topic via HTTP | ||
This sends a messages to the 'tyk-streams-example' Kafka topic via an HTTP request that is handled by Tyk. | ||
Now check the first and second terminals to see that the message 'Hello, Tyk Streams!' has appeared. | ||
EOF | ||
|
||
curl -X POST http://tyk-gateway.localhost:8080/streams-http-to-kafka/post -d 'Hello, Tyk Streams!' |
15 changes: 11 additions & 4 deletions
15
deployments/tyk/scripts/examples/streams/http-to-redis-pubsub/http-to-redis-pubsub-1.sh
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,5 +1,12 @@ | ||
echo "Streams - HTTP to Redis Pub/Sub" | ||
echo "Part 1: Listening to a Redis Channel" | ||
echo "Once connected, run part two of this example in a different terminal. The messages sent will appear here." | ||
echo "Connecting to the Redis channel..." | ||
cat <<EOF | ||
$(printf "\033[1mStreams - HTTP to Redis Pub/Sub\033[0m") | ||
Part 1: Listening to a Redis Channel | ||
Once connected, run part two of this example in a different terminal. The messages sent will appear here. | ||
Connecting to the Redis channel... | ||
EOF | ||
|
||
docker exec tyk-demo-tyk-redis-1 redis-cli SUBSCRIBE streams |
12 changes: 9 additions & 3 deletions
12
deployments/tyk/scripts/examples/streams/http-to-redis-pubsub/http-to-redis-pubsub-2.sh
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,4 +1,10 @@ | ||
echo "Streams - HTTP to Redis Pub/Sub" | ||
echo "Part 2: Sending a message" | ||
echo "Each time this script is run, the message \"Hello, Tyk Streams!\" will be received through the Redis channel in part 1. Check the other terminal to see the messages." | ||
cat <<EOF | ||
$(printf "\033[1mStreams - HTTP to Redis Pub/Sub\033[0m") | ||
Part 2: Sending a message | ||
Each time this script is run, the message \"Hello, Tyk Streams!\" will be received through the Redis channel in part 1. Check the other terminal to see the messages. | ||
EOF | ||
|
||
curl -d 'Hello, Tyk Streams!' http://tyk-gateway.localhost:8080/streams-http-to-redis-pubsub/post |
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
12 changes: 9 additions & 3 deletions
12
deployments/tyk/scripts/examples/streams/http-to-ws/http-to-ws-2.sh
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,4 +1,10 @@ | ||
echo "Streams - HTTP to Websocket Example" | ||
echo "Part 2: Sending a message" | ||
echo "Each time this script is run, the message \"Hello, Tyk Streams!\" will be received through the websocket in part 1. Check the other terminal to see the messages." | ||
cat <<EOF | ||
$(printf "\033[1mStreams - HTTP to Websocket Example\033[0m") | ||
Part 2: Sending a message | ||
Each time this script is run, the message \"Hello, Tyk Streams!\" will be received through the websocket in part 1. Check the other terminal to see the messages. | ||
EOF | ||
|
||
curl -d '{"message":"Hello, Tyk Streams!"}' http://tyk-gateway.localhost:8080/streams-http-to-websocket/post |