Casper Andersen
Casper Andersen

Reputation: 21

WSO2 Stream Processor (SP) Json string cannot be parsed to a json object

Here I have a siddhi application setup like below:

WSO2 SP

I have saved it and started it. I am trying to start an event in the cmd as shown below:

Console log

But I get this error;

error message

Any idea as to how it may be fixed?

my understanding of this subject is rather limited and I am unsure as to what is wrong, any help would be greatly appreciated :)

Upvotes: 0

Views: 89

Answers (1)

ycr
ycr

Reputation: 14574

Here is a sample for HTTP events with a log Sink with a JSON payload.

@Source(type = 'http',
        receiver.url='http://localhost:8006/productionStream',
        basic.auth.enabled='false',
        @map(type='json'))
define stream SweetProductionStream (name string, amount double);

@sink(type='log')
define stream OutputStream (name string, amount double);

@info(name='passThrough')
from SweetProductionStream
select *
insert into OutputStream;

curl

curl -X POST -d "{\"event\":{\"name\":\"Cake\",\"amount\":20.12}}" http://localhost:8006/productionStream --header "Content-Type:application/json"

Upvotes: 1

Related Questions