Bandook
Bandook

Reputation: 708

Failed to create CamelSalesforcesourceSourceConnector: ResolveEndpointFailedException

Background: I am a python developer & have never done Java.

Camel Salesforce Source Connector: v3.20.6 ( I have tried 3.21.0 & 4.0.0 and I'm facing the same issue)
Kafka: v3.6.1

Issue:

Trying to create CamelSalesforcesourceSourceConnector for my kafka instance and it fails with the exception ResolveEndpointFailedException. I have tried a few variations of creating the connector using Kafka's REST API.

Variation 1:

{ "name": "sf-source-connector", "config": { "tasks.max":"1", "connector.class":"org.apache.camel.kafkaconnector.salesforcesource.CamelSalesforcesourceSourceConnector", "key.converter":"org.apache.kafka.connect.storage.StringConverter", "value.converter":"org.apache.kafka.connect.storage.StringConverter", "camel.kamelet.salesforce-source.query": "SELECT * FROM Account", "camel.kamelet.salesforce-source.topicName": "/data/AccountChangeEvent", "camel.kamelet.salesforce-source.loginUrl": "https://login.salesforce.com/", "camel.kamelet.salesforce-source.clientId": "", "camel.kamelet.salesforce-source.clientSecret": "", "camel.kamelet.salesforce-source.userName": "", "camel.kamelet.salesforce-source.password": "", "camel.kamelet.salesforce-source.notifyForOperationCreate": "true", "camel.kamelet.salesforce-source.notifyForOperationUpdate": "true", "camel.kamelet.salesforce-source.notifyForOperationDelete": "true", "camel.kamelet.salesforce-source.notifyForOperationUndelete": "true", "camel.source.endpoint.rawPayload": "true", "camel.kamelet.salesforce-source.operation": "subscribe", "topics": "camelsfstream" } }

Failure Exception Summary -

Starts with - org.apache.kafka.connect.errors.ConnectException: Failed to create and start Camel context\n\tat org.apache.camel.kafkaconnector.CamelSourceTask.start(CamelSourceTask.java:184) Ends with - Caused by: java.lang.IllegalArgumentException: /data/AccountChangeEvent\n\tat org.apache.camel.component.salesforce.internal.OperationName.fromValue(OperationName.java:128)\n\tat org.apache.camel.component.salesforce.SalesforceComponent.createEndpoint(SalesforceComponent.java:303)\n\tat org.apache.camel.support.DefaultComponent.createEndpoint(DefaultComponent.java:171)\n\tat org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(AbstractCamelContext.java:975)

Key Issue -

IllegalArgumentException: /data/AccountChangeEvent

Variation 2 -

In my connector I replaced the topic name: "camel.kamelet.salesforce-source.topicName": "subscribe:/data/AccountChangeEvent"

The exception starts with Failed to create and start Camel context, but the final exception changes to -

due to: There are 1 parameters that couldn't be set on the endpoint. Check the uri if the parameters are spelt correctly and that they are properties of the endpoint. Unknown parameters=[{operationName=subscribe}]

I am unable to overwrite the endpoint url to test the above variation without the operationName and I am also aware that subscribe is the default. So even if I remove that property from the json, it makes no difference.

On another note the endpoint starts with local-salesforce-1:// the # increments - is that right? I couldnt find any property to change this. I imagine it gets replaced eventually.

Raised github issue - https://github.com/apache/camel-kafka-connector/issues/1587

Upvotes: 0

Views: 99

Answers (1)

Bandook
Bandook

Reputation: 708

Found a workaround that is described in my own github issue as a comment - https://github.com/apache/camel-kafka-connector/issues/1587#issuecomment-1903530176

In summary, moved to connector version 3.18.x, before the operationName was added as a kamelet property and added the operation as a prefix in the topic. Did face a few more issues and its resolution is described in my github comment (linked above).

Edit - Another issue: The received message did not contain the record-id / sObjectId of the record in the payload nor in the header. A workaround for this converter v3.18.x has been described at https://github.com/apache/camel-kafka-connector/issues/1592#issuecomment-1905444125

Permanent fix for both the issues (operationName & no recordId in message) has been added to the release milestone and can be tracked here -

Upvotes: 0

Related Questions