This is an automated email from the ASF dual-hosted git repository.
oscerd pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git
The following commit(s) were added to refs/heads/main by this push:
new 13f59f7d9 Fix #2263: add a Salesforce Pub/Sub source Kamelet (#3012)
13f59f7d9 is described below
commit 13f59f7d9db4e3f47d6ce0fef9966064d3d51847
Author: Andrea Cosentino <[email protected]>
AuthorDate: Tue Sep 8 09:40:21 2026 +0200
Fix #2263: add a Salesforce Pub/Sub source Kamelet (#3012)
camel-salesforce has supported the gRPC Pub/Sub API for a while -- the
operations enum carries pubSubSubscribe and pubSubPublish -- but the catalog
only covered the older streaming API through salesforce-source. This adds a
source for the modern one.
deserializeType defaults to JSON rather than the component default of AVRO.
A Kamelet emits to kamelet:sink, and AVRO puts binary on the body that the
next step has to decode; JSON is usable as-is. The other four values remain
available, and the description says which default is the component's.
The Kamelet description carries a runtime caveat found while verifying it:
under Camel JBang the resolved protobuf-java is older than the generated
gRPC stubs in camel-salesforce expect, and the route dies at class loading
with NoClassDefFoundError on com.google.protobuf.RuntimeVersion long before
any endpoint is built. Adding protobuf-java explicitly fixes it.
Verified with that dependency in place: the component starts, attempts a
real login and fails only with UnknownHostException against a deliberately
invalid loginUrl, so every parameter binds and the gRPC path is reached.
Marked Preview, no Citrus test: this needs a real Salesforce org.
Claude-Session: https://claude.ai/code/session_01Tz352mt7yzGWLfvYTBo2Dk
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
---
docs/modules/ROOT/nav.adoc | 1 +
kamelets/salesforce-pubsub-source.kamelet.yaml | 134 +++++++++++++++++++++
.../kamelets/salesforce-pubsub-source.kamelet.yaml | 134 +++++++++++++++++++++
3 files changed, 269 insertions(+)
diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc
index 216389c34..905971cb8 100644
--- a/docs/modules/ROOT/nav.adoc
+++ b/docs/modules/ROOT/nav.adoc
@@ -212,6 +212,7 @@
* xref:salesforce-composite-upsert-sink.adoc[]
* xref:salesforce-create-sink.adoc[]
* xref:salesforce-delete-sink.adoc[]
+* xref:salesforce-pubsub-source.adoc[]
* xref:salesforce-source.adoc[]
* xref:salesforce-update-sink.adoc[]
* xref:sap-netweaver-sink.adoc[]
diff --git a/kamelets/salesforce-pubsub-source.kamelet.yaml
b/kamelets/salesforce-pubsub-source.kamelet.yaml
new file mode 100644
index 000000000..4bc3455f0
--- /dev/null
+++ b/kamelets/salesforce-pubsub-source.kamelet.yaml
@@ -0,0 +1,134 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+ name: salesforce-pubsub-source
+ annotations:
+ camel.apache.org/kamelet.support.level: "Preview"
+ camel.apache.org/catalog.version: "4.22.1-SNAPSHOT"
+ camel.apache.org/kamelet.icon:
"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHZpZXdCb3g9IjAgMCA0OCA0OCIgdmVyc2lvbj0iMS4xIj48ZyBpZD0ic3VyZmFjZTEiPjxwYXRoIGQ9Ik0zNi41IDEyYy0xLjMyNCAwLTIuNTkuMjU4LTMuNzU4LjcwM0E3Ljk5NCA3Ljk5NCAwIDAgMCAyNiA5Yy0yLjEwNSAwLTQuMDIuODItNS40NDUgMi4xNTJBOS40NjggOS40NjggMCAwIDAgMTMuNSA4QzguMjU0IDggNCAxMi4yNTQgNCAxNy41YzAgLj
[...]
+ camel.apache.org/provider: "Apache Software Foundation"
+ camel.apache.org/kamelet.group: "Salesforce"
+ camel.apache.org/kamelet.namespace: "Salesforce"
+ labels:
+ camel.apache.org/kamelet.type: "source"
+spec:
+ definition:
+ title: "Salesforce Pub/Sub Source"
+ description: |-
+ Receive events from the Salesforce Pub/Sub API.
+
+ This is the gRPC based Pub/Sub API, not the older streaming API that
salesforce-source uses. Subscribe to a channel such as /event/MyEvent__e,
/topic/MyTopic or /data/AccountChangeEvent.
+
+ The Pub/Sub API is gRPC based and needs a protobuf-java new enough for
the generated stubs in camel-salesforce. Under Camel JBang an older protobuf is
resolved and the route fails to start with NoClassDefFoundError on
com.google.protobuf.RuntimeVersion; adding protobuf-java as an explicit
dependency resolves it.
+ required:
+ - topic
+ - clientId
+ - clientSecret
+ - userName
+ - password
+ type: object
+ properties:
+ topic:
+ title: Topic
+ description: The Pub/Sub channel to subscribe to.
+ type: string
+ example: "/event/BatchApexErrorEvent"
+ loginUrl:
+ title: Login URL
+ description: The Salesforce instance used to authenticate.
+ type: string
+ default: "https://login.salesforce.com"
+ clientId:
+ title: Consumer Key
+ description: The Salesforce application consumer key.
+ type: string
+ x-descriptors:
+ - urn:camel:group:credentials
+ clientSecret:
+ title: Consumer Secret
+ description: The Salesforce application consumer secret.
+ type: string
+ format: password
+ x-descriptors:
+ - urn:camel:group:credentials
+ userName:
+ title: Username
+ description: The Salesforce username.
+ type: string
+ x-descriptors:
+ - urn:camel:group:credentials
+ password:
+ title: Password
+ description: The Salesforce user password.
+ type: string
+ format: password
+ x-descriptors:
+ - urn:camel:group:credentials
+ deserializeType:
+ title: Deserialize Type
+ description: >-
+ How to deserialise the received events. This Kamelet defaults to
JSON so the body is
+ usable downstream without further decoding; the component's own
default is AVRO, which
+ emits binary. Use POJO together with pojoClass to deserialise into a
generated class.
+ type: string
+ default: "JSON"
+ enum: ["AVRO", "SPECIFIC_RECORD", "GENERIC_RECORD", "POJO", "JSON"]
+ pojoClass:
+ title: POJO Class
+ description: The fully qualified class name to deserialise into. Only
used when deserializeType is POJO.
+ type: string
+ replayPreset:
+ title: Replay Preset
+ description: Where to start reading the channel. LATEST receives only
new events, EARLIEST replays from the retention window, CUSTOM starts from
replayId.
+ type: string
+ default: "LATEST"
+ enum: ["LATEST", "EARLIEST", "CUSTOM"]
+ replayId:
+ title: Replay Id
+ description: The replay id to resume from. Only used when replayPreset
is CUSTOM.
+ type: string
+ batchSize:
+ title: Batch Size
+ description: The number of events requested from the Pub/Sub API in a
single fetch.
+ type: integer
+ default: 100
+ dependencies:
+ - "camel:core"
+ - "camel:salesforce"
+ - "camel:kamelet"
+ template:
+ beans:
+ - name: local-salesforce-pubsub
+ type:
"#class:org.apache.camel.component.salesforce.SalesforceComponent"
+ properties:
+ clientId: "{{clientId}}"
+ clientSecret: "{{clientSecret}}"
+ userName: "{{userName}}"
+ password: "{{password}}"
+ loginUrl: "{{loginUrl}}"
+ from:
+ uri: "{{local-salesforce-pubsub}}:pubSubSubscribe:{{topic}}"
+ parameters:
+ pubSubDeserializeType: "{{deserializeType}}"
+ pubSubPojoClass: "{{?pojoClass}}"
+ replayPreset: "{{replayPreset}}"
+ pubSubReplayId: "{{?replayId}}"
+ pubSubBatchSize: "{{batchSize}}"
+ steps:
+ - to: "kamelet:sink"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/salesforce-pubsub-source.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/salesforce-pubsub-source.kamelet.yaml
new file mode 100644
index 000000000..4bc3455f0
--- /dev/null
+++
b/library/camel-kamelets/src/main/resources/kamelets/salesforce-pubsub-source.kamelet.yaml
@@ -0,0 +1,134 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+ name: salesforce-pubsub-source
+ annotations:
+ camel.apache.org/kamelet.support.level: "Preview"
+ camel.apache.org/catalog.version: "4.22.1-SNAPSHOT"
+ camel.apache.org/kamelet.icon:
"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHZpZXdCb3g9IjAgMCA0OCA0OCIgdmVyc2lvbj0iMS4xIj48ZyBpZD0ic3VyZmFjZTEiPjxwYXRoIGQ9Ik0zNi41IDEyYy0xLjMyNCAwLTIuNTkuMjU4LTMuNzU4LjcwM0E3Ljk5NCA3Ljk5NCAwIDAgMCAyNiA5Yy0yLjEwNSAwLTQuMDIuODItNS40NDUgMi4xNTJBOS40NjggOS40NjggMCAwIDAgMTMuNSA4QzguMjU0IDggNCAxMi4yNTQgNCAxNy41YzAgLj
[...]
+ camel.apache.org/provider: "Apache Software Foundation"
+ camel.apache.org/kamelet.group: "Salesforce"
+ camel.apache.org/kamelet.namespace: "Salesforce"
+ labels:
+ camel.apache.org/kamelet.type: "source"
+spec:
+ definition:
+ title: "Salesforce Pub/Sub Source"
+ description: |-
+ Receive events from the Salesforce Pub/Sub API.
+
+ This is the gRPC based Pub/Sub API, not the older streaming API that
salesforce-source uses. Subscribe to a channel such as /event/MyEvent__e,
/topic/MyTopic or /data/AccountChangeEvent.
+
+ The Pub/Sub API is gRPC based and needs a protobuf-java new enough for
the generated stubs in camel-salesforce. Under Camel JBang an older protobuf is
resolved and the route fails to start with NoClassDefFoundError on
com.google.protobuf.RuntimeVersion; adding protobuf-java as an explicit
dependency resolves it.
+ required:
+ - topic
+ - clientId
+ - clientSecret
+ - userName
+ - password
+ type: object
+ properties:
+ topic:
+ title: Topic
+ description: The Pub/Sub channel to subscribe to.
+ type: string
+ example: "/event/BatchApexErrorEvent"
+ loginUrl:
+ title: Login URL
+ description: The Salesforce instance used to authenticate.
+ type: string
+ default: "https://login.salesforce.com"
+ clientId:
+ title: Consumer Key
+ description: The Salesforce application consumer key.
+ type: string
+ x-descriptors:
+ - urn:camel:group:credentials
+ clientSecret:
+ title: Consumer Secret
+ description: The Salesforce application consumer secret.
+ type: string
+ format: password
+ x-descriptors:
+ - urn:camel:group:credentials
+ userName:
+ title: Username
+ description: The Salesforce username.
+ type: string
+ x-descriptors:
+ - urn:camel:group:credentials
+ password:
+ title: Password
+ description: The Salesforce user password.
+ type: string
+ format: password
+ x-descriptors:
+ - urn:camel:group:credentials
+ deserializeType:
+ title: Deserialize Type
+ description: >-
+ How to deserialise the received events. This Kamelet defaults to
JSON so the body is
+ usable downstream without further decoding; the component's own
default is AVRO, which
+ emits binary. Use POJO together with pojoClass to deserialise into a
generated class.
+ type: string
+ default: "JSON"
+ enum: ["AVRO", "SPECIFIC_RECORD", "GENERIC_RECORD", "POJO", "JSON"]
+ pojoClass:
+ title: POJO Class
+ description: The fully qualified class name to deserialise into. Only
used when deserializeType is POJO.
+ type: string
+ replayPreset:
+ title: Replay Preset
+ description: Where to start reading the channel. LATEST receives only
new events, EARLIEST replays from the retention window, CUSTOM starts from
replayId.
+ type: string
+ default: "LATEST"
+ enum: ["LATEST", "EARLIEST", "CUSTOM"]
+ replayId:
+ title: Replay Id
+ description: The replay id to resume from. Only used when replayPreset
is CUSTOM.
+ type: string
+ batchSize:
+ title: Batch Size
+ description: The number of events requested from the Pub/Sub API in a
single fetch.
+ type: integer
+ default: 100
+ dependencies:
+ - "camel:core"
+ - "camel:salesforce"
+ - "camel:kamelet"
+ template:
+ beans:
+ - name: local-salesforce-pubsub
+ type:
"#class:org.apache.camel.component.salesforce.SalesforceComponent"
+ properties:
+ clientId: "{{clientId}}"
+ clientSecret: "{{clientSecret}}"
+ userName: "{{userName}}"
+ password: "{{password}}"
+ loginUrl: "{{loginUrl}}"
+ from:
+ uri: "{{local-salesforce-pubsub}}:pubSubSubscribe:{{topic}}"
+ parameters:
+ pubSubDeserializeType: "{{deserializeType}}"
+ pubSubPojoClass: "{{?pojoClass}}"
+ replayPreset: "{{replayPreset}}"
+ pubSubReplayId: "{{?replayId}}"
+ pubSubBatchSize: "{{batchSize}}"
+ steps:
+ - to: "kamelet:sink"