mirror of https://github.com/dapr/quickstarts.git
Insights on cloud events
Signed-off-by: shivanisinghnitp <58537821+shivanisinghnitp@users.noreply.github.com>
This commit is contained in:
parent
332ac444a4
commit
fb63aeb868
|
@ -331,7 +331,52 @@ dapr stop --app-id react-form
|
|||
|
||||
<!-- END_STEP -->
|
||||
|
||||
4. If you want to deploy this same application to Kubernetes, move onto the next step. Otherwise, skip ahead to the [How it Works](#How-it-Works) section to understand the code!
|
||||
4. If you want more insights into the cloud events being published on Redis streams, move onto the next section. If you want to deploy this same application to Kubernetes, move onto the section after that. Otherwise, skip ahead to the [How it Works](#How-it-Works) section to understand the code!
|
||||
|
||||
## Insights into the cloud events being published on Redis streams
|
||||
If you want to see the [Cloud Events](https://github.com/cloudevents/spec) that are being published on [Redis stream](https://redis.io/docs/data-types/streams/), follow the below steps:
|
||||
|
||||
1. Redis is running inside of a docker container, so to access it via CLI, we pass the following command to a new terminal:
|
||||
<!-- STEP
|
||||
expected_stdout_lines:
|
||||
- 127.0.0.1:6379>
|
||||
expected_stderr_lines:
|
||||
name: Redis Docker Image
|
||||
-->
|
||||
|
||||
```bash
|
||||
docker exec -it dapr_redis redis-cli
|
||||
```
|
||||
|
||||
<!-- END_STEP -->
|
||||
|
||||
2. There can be multiple items/orders/messages inside a redis stream. It is possible to get the number of orders inside a Stream just using the `XLEN` command:
|
||||
<!-- STEP
|
||||
expected_stdout_lines:
|
||||
- (integer) 3
|
||||
expected_stderr_lines:
|
||||
name: Number of orders in a Redis Stream
|
||||
-->
|
||||
|
||||
```bash
|
||||
XLEN orders
|
||||
```
|
||||
|
||||
<!-- END_STEP -->
|
||||
|
||||
3. To show the details of each order in the redis stream events, we use the `XRANGE` command. We specify two IDs, start and end. The range returned will include the elements having start or end as ID. The two special IDs - and + respectively mean the smallest and the greatest ID possible. We add an optional `COUNT` option at the end to get the first N items only. Below command shows the first 2 events.
|
||||
<!-- STEP
|
||||
expected_stdout_lines:
|
||||
- (array)
|
||||
expected_stderr_lines:
|
||||
name: Details of orders in the redis stream
|
||||
-->
|
||||
|
||||
```bash
|
||||
XRANGE orders - + Count 2
|
||||
```
|
||||
|
||||
<!-- END_STEP -->
|
||||
|
||||
|
||||
## Run in Kubernetes
|
||||
|
|
Loading…
Reference in New Issue