Not able to get Salesforce Platform events in JSON format with Camel Salesforce

classic Classic list List threaded Threaded
2 messages Options
sai
Reply | Threaded
Open this post in threaded view
|

Not able to get Salesforce Platform events in JSON format with Camel Salesforce

sai
Hi,

I'm not able to get Salesforce platform events in JSON format. I receive
the payload in the following format when set rawPayload=true&format=JSON
I used Camel 2.23.x

{data={schema=vzd40uytS5DC7A3Qshi1wQ, payload={TestNull__c=null,
News_Content__c=Fuse Test 2, CreatedById=0053t000007YosdAAC,
CreatedDate=2020-08-11T01:14:26.322Z, Test_c__c=mytest},
event={replayId=892346}}, channel=/event/Test_Fuse_Event__e}

But when i test with EMP_Connector, i got the expected payload below

{"schema":"vzd40uytS5DC7A3Qshi1wQ","payload":{"TestNull__c":null,"News_Content__c":"Fuse
Test
2","CreatedById":"0053t000007YosdAAC","CreatedDate":"2020-08-11T01:16:07.092Z","Test_c__c":"mytest"},"event":{"replayId":892348}}

The null values or number values are coming as strings instead of actual
objects.
Example: "TestNull__c":null is expected
But getting "TestNull__c":"null"

Thank you.
Saiteja Parna.
sai
Reply | Threaded
Open this post in threaded view
|

Re: Not able to get Salesforce Platform events in JSON format with Camel Salesforce

sai
I finally got it working with following:

PlatformEvent platformEvent = exchange.getIn().getBody(PlatformEvent.class);
System.out.println("JSON = " + JSON.toString(platformEvent.getEventData()));



On Mon, Aug 10, 2020 at 7:11 PM Saiteja <[hidden email]> wrote:

> Hi,
>
> I'm not able to get Salesforce platform events in JSON format. I receive
> the payload in the following format when set rawPayload=true&format=JSON
> I used Camel 2.23.x
>
> {data={schema=vzd40uytS5DC7A3Qshi1wQ, payload={TestNull__c=null,
> News_Content__c=Fuse Test 2, CreatedById=0053t000007YosdAAC,
> CreatedDate=2020-08-11T01:14:26.322Z, Test_c__c=mytest},
> event={replayId=892346}}, channel=/event/Test_Fuse_Event__e}
>
> But when i test with EMP_Connector, i got the expected payload below
>
> {"schema":"vzd40uytS5DC7A3Qshi1wQ","payload":{"TestNull__c":null,"News_Content__c":"Fuse
> Test
> 2","CreatedById":"0053t000007YosdAAC","CreatedDate":"2020-08-11T01:16:07.092Z","Test_c__c":"mytest"},"event":{"replayId":892348}}
>
> The null values or number values are coming as strings instead of actual
> objects.
> Example: "TestNull__c":null is expected
> But getting "TestNull__c":"null"
>
> Thank you.
> Saiteja Parna.
>
>