Browse Source

Merge pull request #176 from emqx/rest_bug

Rest bug and merge from master
jinfahua 5 years atrás
parent
commit
b2b8e0962b
3 changed files with 6 additions and 6 deletions
  1. 1 1
      README.md
  2. 2 2
      docs/en_US/edgex/edgex_rule_engine_tutorial.md
  3. 3 3
      xstream/sinks/rest_sink.go

+ 1 - 1
README.md

@@ -112,7 +112,7 @@ It can be run at various IoT edge use scenarios, such as real-time processing of
 | Raspberry Pi 3B+                               | 12k                  | sys+user: 70% | 20M          |
 | AWS t2.micro( 1 Core * 1 GB) <br />Ubuntu18.04 | 10k                  | sys+user: 25% | 20M          |
 
-### Max support rule support
+### Max number of rules support
 
 - 8000 rules with 800 message/second
 - Configurations

+ 2 - 2
docs/en_US/edgex/edgex_rule_engine_tutorial.md

@@ -78,7 +78,7 @@ There are two approaches to manage stream, you can use your preferred approach.
 
 #### Option 1: Use Rest API
 
-The next step is to create a stream that can consuming data from EdgeX message bus. Please change ``127.0.0.1`` to your local Kuiper docker IP address.
+The next step is to create a stream that can consume data from EdgeX message bus. Please change ``$your_server`` to Kuiper docker instance IP address.
 
 ```shell
 curl -X POST \
@@ -211,7 +211,7 @@ Since all of the analysis result are published to  ``tcp://broker.emqx.io:1883``
 
 You'll find that only those randomnumber larger than 30 will be published to ``result`` topic.
 
-You can also type below command to look at the rule execution status. The corresponding REST API is also available for getting rule status, please check [related docuement](../restapi/overview.md).
+You can also type below command to look at the rule execution status. The corresponding REST API is also available for getting rule status, please check [related document](../restapi/overview.md).
 
 ```shell
 # bin/cli getstatus rule rule1

+ 3 - 3
xstream/sinks/rest_sink.go

@@ -280,13 +280,13 @@ func (ms *RestSink) send(v interface{}, logger api.Logger) error {
 	}
 	logger.Debugf("do request: %s %s with %s", ms.method, ms.url, req.Body)
 	resp, err := ms.client.Do(req)
-	if resp.StatusCode < 200 || resp.StatusCode > 299 {
-		return fmt.Errorf("rest sink fails to err http return code: %d.", resp.StatusCode)
-	}
 	if err != nil {
 		return fmt.Errorf("rest sink fails to send out the data")
 	} else {
 		logger.Debugf("rest sink got response %v", resp)
+		if resp.StatusCode < 200 || resp.StatusCode > 299 {
+			return fmt.Errorf("rest sink fails to err http return code: %d.", resp.StatusCode)
+		}
 	}
 	return nil
 }