syndesisio / connectors

Apache Camel Connectors for Syndesis
Apache License 2.0
6 stars 12 forks source link

fix(salesforce): Redo streaming support #82

Closed zregvart closed 6 years ago

zregvart commented 6 years ago

Adding a route at the point when the Component is started is not such a good idea as it leads to ConcurrentModificationException:

Caused by: java.util.ConcurrentModificationException: null
    at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)
    at java.util.ArrayList$Itr.next(ArrayList.java:851)
    at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3713)
    at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3428)
    at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:208)
    at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3236)
    at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3232)
    at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3255)
    at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3232)

That is a new RouteDefinition is added while DefaultCamelContext iterates over existing route routeDefinitions.

The new implementation reuses the base component created by the connector component and cleverly avoids another processor needed to set the headers (sObjectName and sObjectId) needed by the Salesforce component by having SalesforceIdentifier::toString return the ID which will be consumed from the incoming message body and setting sObjectName as endpoint URI property.

pure-bot[bot] commented 6 years ago

Pull request approved by @KurtStam - applying approved label