无法创建Camel Salesforce端点

发布于 2025-01-25 17:26:21 字数 1247 浏览 1 评论 0 原文

我正在尝试使用Apache Camel Salesforce组件连接到Salesforce。

这是我试图开始的一条非常简单的路由:

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

尝试启动它时,我会发现一个明显的错误,说我没有指定客户端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]

这是完全有意义的,因为必须指定ClentID参数。为了解决这个问题,我正在指定 clientId 如下:

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

当尝试启动这段路线时,我会遇到一个相当奇怪的错误,抱怨 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}]

不确定我做错了什么,我应该如何解决这个问题。

预先感谢您的投入。

I am trying to connect to salesforce using Apache Camel salesforce component.

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:

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. To address this I am specifying a clientId as below:

@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:

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

飘过的浮云 2025-02-01 17:26:21

您的问题与以下事实有关:是组件选项 ,因此必须在组件级别上配置它,而您尝试将其配置为查询参数/端点选项,该选项无法正常工作。

根据您使用的运行时间,配置组件的方法可能会更改,但想法保持不变。

例如,假设您使用 application.properties 来配置您的应用程序,则您的Salesforce组件的配置看起来像这样:

in 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>
...

这是Salesforce示例

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.

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:

In 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/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文