remaining question i have is if we still need to do this
```python
logging.warn('[{}] I was asked to encode a message as JSON, but I
failed.'.format(self.trigger))
value = "\"{}\"".format(value)
```
commenting out `value = "\"{}\"".format(value)`
```
>{"hello": "Malalažbeta my weird character \xb6"}
```
```
[2018-08-21T17:43:19.667Z] [INFO] [??] [kafkatriggers]
[/whisk.system/kafkatrigger] Found 1 messages with a total size of 134 bytes
[2018-08-21T17:43:19.668Z] [WARNING] [??] [kafkatriggers]
[/whisk.system/kafkatrigger] I was asked to encode a message as JSON, but I
failed.
[2018-08-21T17:43:19.668Z] [INFO] [??] [kafkatriggers]
[/whisk.system/kafkatrigger] Firing trigger with 1 messages
[2018-08-21T17:43:19.775Z] [INFO] [??] [kafkatriggers]
[/whisk.system/kafkatrigger] Repsonse status code 202
[2018-08-21T17:43:19.776Z] [INFO] [??] [kafkatriggers]
[/whisk.system/kafkatrigger] Fired trigger with activation
13700ae097b44f23b00ae097b41f2375
```
```
➜ openwhisk master ✗ bin/wsk -i --apihost 172.17.0.1 --auth
789c46b1-71f6-4ed5-8c54-816aa4f8c502:abczO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
activation get 13700ae097b44f23b00ae097b41f2375
ok: got activation 13700ae097b44f23b00ae097b41f2375
{
"namespace": "whisk.system",
"name": "kafkatrigger",
"version": "0.0.1",
"subject": "whisk.system",
"activationId": "13700ae097b44f23b00ae097b41f2375",
"start": 1534873399773,
"end": 0,
"duration": 0,
"response": {
"status": "success",
"statusCode": 0,
"success": true,
"result": {
"messages": [
{
"key": null,
"offset": 44623,
"partition": 0,
"topic": "test",
"value": "{\"hello\": \"Malalažbeta my weird character
\\xb6\"}"
}
]
}
},
"logs": [
"{\"statusCode\":0,\"success\":true,\"activationId\":\"b5b86d55c39e437bb86d55c39e537b80\",\"rule\":\"whisk.system/myrule\",\"action\":\"whisk.system/myecho\"}"
],
"annotations": [],
"publish": false
}
```
```
>Malalažbeta my weird character
```
```
[2018-08-21T17:46:00.460Z] [INFO] [??] [kafkatriggers]
[/whisk.system/kafkatrigger] Found 1 messages with a total size of 111 bytes
[2018-08-21T17:46:00.460Z] [WARNING] [??] [kafkatriggers]
[/whisk.system/kafkatrigger] I was asked to encode a message as JSON, but I
failed.
[2018-08-21T17:46:00.461Z] [INFO] [??] [kafkatriggers]
[/whisk.system/kafkatrigger] Firing trigger with 1 messages
[2018-08-21T17:46:00.480Z] [INFO] [??] [kafkatriggers]
[/whisk.system/kafkatrigger] Repsonse status code 202
[2018-08-21T17:46:00.480Z] [INFO] [??] [kafkatriggers]
[/whisk.system/kafkatrigger] Fired trigger with activation
a5f4ea6d4c8840cfb4ea6d4c88a0cfba
```
```
➜ openwhisk master ✗ bin/wsk -i --apihost 172.17.0.1 --auth
789c46b1-71f6-4ed5-8c54-816aa4f8c502:abczO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
activation get a5f4ea6d4c8840cfb4ea6d4c88a0cfba
ok: got activation a5f4ea6d4c8840cfb4ea6d4c88a0cfba
{
"namespace": "whisk.system",
"name": "kafkatrigger",
"version": "0.0.1",
"subject": "whisk.system",
"activationId": "a5f4ea6d4c8840cfb4ea6d4c88a0cfba",
"start": 1534873560476,
"end": 0,
"duration": 0,
"response": {
"status": "success",
"statusCode": 0,
"success": true,
"result": {
"messages": [
{
"key": null,
"offset": 44624,
"partition": 0,
"topic": "test",
"value": "Malalažbeta my weird character"
}
]
}
},
"logs": [
"{\"statusCode\":0,\"success\":true,\"activationId\":\"821fc59af01c41d39fc59af01c31d3cd\",\"rule\":\"whisk.system/myrule\",\"action\":\"whisk.system/myecho\"}"
],
"annotations": [],
"publish": false
}
```
```
>"Malalažbeta my weird character \xb6"
```
```
[2018-08-21T17:47:11.171Z] [INFO] [??] [kafkatriggers]
[/whisk.system/kafkatrigger] Found 1 messages with a total size of 121 bytes
[2018-08-21T17:47:11.171Z] [WARNING] [??] [kafkatriggers]
[/whisk.system/kafkatrigger] I was asked to encode a message as JSON, but I
failed.
[2018-08-21T17:47:11.172Z] [INFO] [??] [kafkatriggers]
[/whisk.system/kafkatrigger] Firing trigger with 1 messages
[2018-08-21T17:47:11.190Z] [INFO] [??] [kafkatriggers]
[/whisk.system/kafkatrigger] Repsonse status code 202
[2018-08-21T17:47:11.190Z] [INFO] [??] [kafkatriggers]
[/whisk.system/kafkatrigger] Fired trigger with activation
5d12c3b9e22c415692c3b9e22c5156b7
```
```
➜ openwhisk master ✗ bin/wsk -i --apihost 172.17.0.1 --auth
789c46b1-71f6-4ed5-8c54-816aa4f8c502:abczO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
activation get 5d12c3b9e22c415692c3b9e22c5156b7
ok: got activation 5d12c3b9e22c415692c3b9e22c5156b7
{
"namespace": "whisk.system",
"name": "kafkatrigger",
"version": "0.0.1",
"subject": "whisk.system",
"activationId": "5d12c3b9e22c415692c3b9e22c5156b7",
"start": 1534873631186,
"end": 0,
"duration": 0,
"response": {
"status": "success",
"statusCode": 0,
"success": true,
"result": {
"messages": [
{
"key": null,
"offset": 44625,
"partition": 0,
"topic": "test",
"value": "\"Malalažbeta my weird character \\xb6\""
}
]
}
},
"logs": [
"{\"statusCode\":0,\"success\":true,\"activationId\":\"7975e10335b94949b5e10335b9894942\",\"rule\":\"whisk.system/myrule\",\"action\":\"whisk.system/myecho\"}"
],
"annotations": [],
"publish": false
}
```
So, it looks like the input is already escaped as a string even without that
line
[ Full content available at:
https://github.com/apache/incubator-openwhisk-package-kafka/pull/279 ]
This message was relayed via gitbox.apache.org for [email protected]