简体   繁体   English

无法创建骆驼 salesforce 端点

[英]Unable to create camel salesforce endpoint

I am trying to connect to salesforce using Apache Camel salesforce component.我正在尝试使用 Apache Camel salesforce 组件连接到 salesforce。

Here is a very simple route I am trying to start:这是我尝试开始的一条非常简单的路线:

@Override
public void configure() throws Exception {
    from("salesforce:event/Case__e")
            .to("mock:end");
}

When trying to start it I am getting an obvious error saying I did not specify a client id:尝试启动它时,我收到一个明显的错误,提示我没有指定客户端 ID:

Caused by: java.lang.IllegalArgumentException: clientId must be specified
at org.apache.camel.util.ObjectHelper.notNull(ObjectHelper.java:149) ~[camel-util-3.16.0.jar:3.16.0]
at org.apache.camel.component.salesforce.SalesforceLoginConfig.validate(SalesforceLoginConfig.java:238) ~[camel-salesforce-3.16.0.jar:3.16.0]

That makes perfectly sense as according to Camel docs clentId parameter must be specified.根据 Camel 文档,这非常有意义,因为必须指定 clentId 参数。 To address this I am specifying a clientId as below:为了解决这个问题,我指定了一个clientId ,如下所示:

@Override
public void configure() throws Exception {
    from("salesforce:event/Case__e?clientId=xyz")
            .to("mock:end");
}

When trying to start the route this time I am getting a rather strange error complaining about clientId being an unknown parameter:这次尝试启动路线时,我收到一个相当奇怪的错误,抱怨clientId是一个未知参数:

Failed to resolve endpoint: salesforce://event/Case__e?clientId=xyz 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=[{clientId=xyz}]

Not sure what I am doing wrong and how should I address this.不确定我做错了什么以及我应该如何解决这个问题。

Thank you in advance for your inputs.提前感谢您的投入。

Your problem is related to the fact that clientId is a component option so it must be configured at the component level while you try to configure it like it was a query parameter / an endpoint option which cannot work.您的问题与clientId组件选项这一事实有关,因此当您尝试将其配置为查询参数/端点选项时,必须在组件级别对其进行配置,这无法正常工作。

Depending on the runtime that you use, the way to configure a component may change but the idea remains the same.根据您使用的运行时,配置组件的方式可能会改变,但想法保持不变。

For example, assuming that you use an application.properties to configure your application, the configuration of your salesforce component would look like this:例如,假设您使用application.properties来配置您的应用程序,您的 salesforce 组件的配置将如下所示:

In application.properties在 application.properties 中

# Salesforce credentials
camel.component.salesforce.login-config.client-id=<Your Client ID>
camel.component.salesforce.login-config.client-secret=<Your Client Secret>
camel.component.salesforce.login-config.refresh-token=<Your Refresh Token>
...

Here is a salesforce example https://github.com/apache/camel-examples/blob/main/examples/salesforce-consumer/这是一个 salesforce 示例https://github.com/apache/camel-examples/blob/main/examples/salesforce-consumer/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM