You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Rama, Ravichander" <Ra...@elavon.com> on 2020/12/30 19:05:15 UTC

camel-salesforce:change data capture issue

I am trying to receive salesforce change data capture event body from salesforce, but receiving null (empty message) value when there is any update on Account object, expecting complete response body.

Can you please help, which version that I am supposed to use?



<dependencyManagement>

                 <dependencies>

                          <dependency>

                                   <groupId>org.apache.camel</groupId>

                                   <artifactId>camel-spring-boot-dependencies</artifactId>

                                   <version>2.24.0</version>

                                   <type>pom</type>

                                   <scope>import</scope>

                          </dependency>

                 </dependencies>

         </dependencyManagement>

Here is complete route builder
@Component
    class EventConsumerRouteBuilder extends RouteBuilder {
        @Override
        public void configure() throws Exception {

            SalesforceEndpointConfig config = new SalesforceEndpointConfig();
            config.setApiVersion("49.0");
            SalesforceComponent component = this.getContext().getComponent("salesforce", SalesforceComponent.class);
            component.setConfig(config);

            from("salesforce:event/Order_Event__e?replayId=-1&rawPayload=true")
                    .log("Platform Event Received: ${body}");

            //from("salesforce:data/AccountChangeEvent?replayId=-1&rawPayload=true")
            from("salesforce:data/AccountChangeEvent?replayId=-1")
            .log("CDC Event Received: ${body}");

        }
    }

Below are logs, I am using api version "45.0" and camel version "2.24.0".



2020-12-22 08:21:22.225  INFO 27340 --- [ent@6475472c-48] o.a.c.c.s.i.s.SubscriptionHelper         : Subscribed to channel /data/AccountChangeEvent

2020-12-22 08:23:11.596 DEBUG 27340 --- [ent@6475472c-46] o.a.c.c.s.i.s.SubscriptionHelper$5       : Received messages [{clientId=h3ectdw6piysatb1a1t7s1bopn5q, channel=/meta/connect, id=3, successful=true}]

2020-12-22 08:23:11.596 DEBUG 27340 --- [ent@6475472c-46] o.a.c.c.s.i.s.SubscriptionHelper         : [CHANNEL:META_CONNECT]: {clientId=h3ectdw6piysatb1a1t7s1bopn5q, channel=/meta/connect, id=3, successful=true}

2020-12-22 08:23:56.036 DEBUG 27340 --- [ent@6475472c-45] o.a.c.c.s.i.s.SubscriptionHelper$5       : Received messages [{data={schema=qlbfz598kJgHdPdgIoLiLw, payload={LastModifiedDate=2020-12-22T13:23:57.000Z, Full_Account_Name__c=Test1234rc, ChangeEventHeader={commitNumber=10724561884739, commitUser=00556000004IScuAAG, sequenceNumber=1, entityName=Account, changeType=UPDATE, changedFields=[Ljava.lang.Object;@409e2f60, changeOrigin=com/salesforce/api/soap/50.0;client=SfdcInternalAPI/, transactionKey=0008ea61-2c18-977d-6f6f-a853fecd091a, commitTimestamp=1608643437000, recordIds=[Ljava.lang.Object;@2baf97bc}}, event={replayId=29127}}, channel=/data/AccountChangeEvent}, {clientId=h3ectdw6piysatb1a1t7s1bopn5q, channel=/meta/connect, id=5, successful=true}]

2020-12-22 08:23:56.036 DEBUG 27340 --- [ent@6475472c-45] o.a.c.c.s.i.s.SubscriptionHelper         : Received Message: {data={schema=qlbfz598kJgHdPdgIoLiLw, payload={LastModifiedDate=2020-12-22T13:23:57.000Z, Full_Account_Name__c=Test1234rc, ChangeEventHeader={commitNumber=10724561884739, commitUser=00556000004IScuAAG, sequenceNumber=1, entityName=Account, changeType=UPDATE, changedFields=[Ljava.lang.Object;@409e2f60, changeOrigin=com/salesforce/api/soap/50.0;client=SfdcInternalAPI/, transactionKey=0008ea61-2c18-977d-6f6f-a853fecd091a, commitTimestamp=1608643437000, recordIds=[Ljava.lang.Object;@2baf97bc}}, event={replayId=29127}}, channel=/data/AccountChangeEvent}

2020-12-22 08:23:56.040 DEBUG 27340 --- [ent@6475472c-45] o.a.c.c.salesforce.SalesforceConsumer    : Received event /data/AccountChangeEvent on channel /data/AccountChangeEvent

2020-12-22 08:23:56.062 DEBUG 27340 --- [ent@6475472c-45] o.a.c.c.salesforce.SalesforceConsumer    : Received SObject: null

2020-12-22 08:23:56.079  INFO 27340 --- [ent@6475472c-45] testLog                                  : Exchange[Id: ID-LATL-4SV4KR2-1608643268617-0-1, ExchangePattern: InOnly, Properties: {CamelCreatedTimestamp=Tue Dec 22 08:23:56 EST 2020, CamelExternalRedelivered=false, CamelMessageHistory=[DefaultMessageHistory[routeId=route1, node=to1]], CamelToEndpoint=log://testLog?showAll=true}, Headers: {breadcrumbId=ID-LATL-4SV4KR2-1608643268617-0-1, CamelSalesforceChannel=/data/AccountChangeEvent, CamelSalesforceCreatedDate=null, CamelSalesforceEventType=null, CamelSalesforceReplayId=29127, CamelSalesforceTopicName=data/AccountChangeEvent}, BodyType: String, Body: null, Out: null: ]

2020-12-22 08:23:56.086 DEBUG 27340 --- [ent@6475472c-45] o.a.c.c.s.i.s.SubscriptionHelper         : [CHANNEL:META_CONNECT]: {clientId=h3ectdw6piysatb1a1t7s1bopn5q, channel=/meta/connect, id=5, successful=true}

The information contained in this e-mail and in any attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. This message has been scanned for known computer viruses.

Re: camel-salesforce:change data capture issue

Posted by Zoran Regvart <zo...@regvart.com>.
Hi Rama,
with rawPayload=true you should receive a org.cometd.bayeux.Message
instance, see the docs[1] on this. The change data capture events are
only supported on 3.x, see[2].

zoran

[1] https://camel.apache.org/components/latest/salesforce-component.html#_platform_events
[2] https://issues.apache.org/jira/browse/CAMEL-13559

On Thu, Dec 31, 2020 at 7:36 AM Rama, Ravichander
<Ra...@elavon.com> wrote:
>
> I am trying to receive salesforce change data capture event body from salesforce, but receiving null (empty message) value when there is any update on Account object, expecting complete response body.
>
> Can you please help, which version that I am supposed to use?
>
>
>
> <dependencyManagement>
>
>                  <dependencies>
>
>                           <dependency>
>
>                                    <groupId>org.apache.camel</groupId>
>
>                                    <artifactId>camel-spring-boot-dependencies</artifactId>
>
>                                    <version>2.24.0</version>
>
>                                    <type>pom</type>
>
>                                    <scope>import</scope>
>
>                           </dependency>
>
>                  </dependencies>
>
>          </dependencyManagement>
>
> Here is complete route builder
> @Component
>     class EventConsumerRouteBuilder extends RouteBuilder {
>         @Override
>         public void configure() throws Exception {
>
>             SalesforceEndpointConfig config = new SalesforceEndpointConfig();
>             config.setApiVersion("49.0");
>             SalesforceComponent component = this.getContext().getComponent("salesforce", SalesforceComponent.class);
>             component.setConfig(config);
>
>             from("salesforce:event/Order_Event__e?replayId=-1&rawPayload=true")
>                     .log("Platform Event Received: ${body}");
>
>             //from("salesforce:data/AccountChangeEvent?replayId=-1&rawPayload=true")
>             from("salesforce:data/AccountChangeEvent?replayId=-1")
>             .log("CDC Event Received: ${body}");
>
>         }
>     }
>
> Below are logs, I am using api version "45.0" and camel version "2.24.0".
>
>
>
> 2020-12-22 08:21:22.225  INFO 27340 --- [ent@6475472c-48] o.a.c.c.s.i.s.SubscriptionHelper         : Subscribed to channel /data/AccountChangeEvent
>
> 2020-12-22 08:23:11.596 DEBUG 27340 --- [ent@6475472c-46] o.a.c.c.s.i.s.SubscriptionHelper$5       : Received messages [{clientId=h3ectdw6piysatb1a1t7s1bopn5q, channel=/meta/connect, id=3, successful=true}]
>
> 2020-12-22 08:23:11.596 DEBUG 27340 --- [ent@6475472c-46] o.a.c.c.s.i.s.SubscriptionHelper         : [CHANNEL:META_CONNECT]: {clientId=h3ectdw6piysatb1a1t7s1bopn5q, channel=/meta/connect, id=3, successful=true}
>
> 2020-12-22 08:23:56.036 DEBUG 27340 --- [ent@6475472c-45] o.a.c.c.s.i.s.SubscriptionHelper$5       : Received messages [{data={schema=qlbfz598kJgHdPdgIoLiLw, payload={LastModifiedDate=2020-12-22T13:23:57.000Z, Full_Account_Name__c=Test1234rc, ChangeEventHeader={commitNumber=10724561884739, commitUser=00556000004IScuAAG, sequenceNumber=1, entityName=Account, changeType=UPDATE, changedFields=[Ljava.lang.Object;@409e2f60, changeOrigin=com/salesforce/api/soap/50.0;client=SfdcInternalAPI/, transactionKey=0008ea61-2c18-977d-6f6f-a853fecd091a, commitTimestamp=1608643437000, recordIds=[Ljava.lang.Object;@2baf97bc}}, event={replayId=29127}}, channel=/data/AccountChangeEvent}, {clientId=h3ectdw6piysatb1a1t7s1bopn5q, channel=/meta/connect, id=5, successful=true}]
>
> 2020-12-22 08:23:56.036 DEBUG 27340 --- [ent@6475472c-45] o.a.c.c.s.i.s.SubscriptionHelper         : Received Message: {data={schema=qlbfz598kJgHdPdgIoLiLw, payload={LastModifiedDate=2020-12-22T13:23:57.000Z, Full_Account_Name__c=Test1234rc, ChangeEventHeader={commitNumber=10724561884739, commitUser=00556000004IScuAAG, sequenceNumber=1, entityName=Account, changeType=UPDATE, changedFields=[Ljava.lang.Object;@409e2f60, changeOrigin=com/salesforce/api/soap/50.0;client=SfdcInternalAPI/, transactionKey=0008ea61-2c18-977d-6f6f-a853fecd091a, commitTimestamp=1608643437000, recordIds=[Ljava.lang.Object;@2baf97bc}}, event={replayId=29127}}, channel=/data/AccountChangeEvent}
>
> 2020-12-22 08:23:56.040 DEBUG 27340 --- [ent@6475472c-45] o.a.c.c.salesforce.SalesforceConsumer    : Received event /data/AccountChangeEvent on channel /data/AccountChangeEvent
>
> 2020-12-22 08:23:56.062 DEBUG 27340 --- [ent@6475472c-45] o.a.c.c.salesforce.SalesforceConsumer    : Received SObject: null
>
> 2020-12-22 08:23:56.079  INFO 27340 --- [ent@6475472c-45] testLog                                  : Exchange[Id: ID-LATL-4SV4KR2-1608643268617-0-1, ExchangePattern: InOnly, Properties: {CamelCreatedTimestamp=Tue Dec 22 08:23:56 EST 2020, CamelExternalRedelivered=false, CamelMessageHistory=[DefaultMessageHistory[routeId=route1, node=to1]], CamelToEndpoint=log://testLog?showAll=true}, Headers: {breadcrumbId=ID-LATL-4SV4KR2-1608643268617-0-1, CamelSalesforceChannel=/data/AccountChangeEvent, CamelSalesforceCreatedDate=null, CamelSalesforceEventType=null, CamelSalesforceReplayId=29127, CamelSalesforceTopicName=data/AccountChangeEvent}, BodyType: String, Body: null, Out: null: ]
>
> 2020-12-22 08:23:56.086 DEBUG 27340 --- [ent@6475472c-45] o.a.c.c.s.i.s.SubscriptionHelper         : [CHANNEL:META_CONNECT]: {clientId=h3ectdw6piysatb1a1t7s1bopn5q, channel=/meta/connect, id=5, successful=true}
>
> The information contained in this e-mail and in any attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. This message has been scanned for known computer viruses.



-- 
Zoran Regvart