[
https://issues.apache.org/jira/browse/CAMEL-15338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andrea Cosentino updated CAMEL-15338:
-------------------------------------
Fix Version/s: 3.4.3
3.5.0
> Salesforce - Wrong Channel Name for Standard Platform Events
> ------------------------------------------------------------
>
> Key: CAMEL-15338
> URL: https://issues.apache.org/jira/browse/CAMEL-15338
> Project: Camel
> Issue Type: Bug
> Components: camel-salesforce
> Affects Versions: 3.4.2
> Reporter: Yulia Buzlukova
> Assignee: Andrea Cosentino
> Priority: Major
> Fix For: 3.5.0, 3.4.3
>
>
> For channels starting with "/event/" "__e" suffix is always added to the
> channel name in
> [SubscriptionHelper|https://github.com/apache/camel/blob/camel-3.4.x/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/streaming/SubscriptionHelper.java#L542].
>
> However, according to salesforce documentation [_API names of standard
> platform events, such as AssetTokenEvent, don't include a
> suffix_|https://developer.salesforce.com/docs/atlas.en-us.platform_events.meta/platform_events/platform_events_define_ui.htm].
>
> As a result, camel salesforce component cannot subscribe to Standard Event
> channels.
> *Suggestion*: not to add "__e" suffix to all events, but leave it to endpoint
> configuration.
>
> || ||EndPoint||Channel Name returned by SubscriptionHelper||Result||
> |*Current
> Approach*|salesforce:/event/LoginEventStream?replayId=-1|/event/LoginEventStream__e|"subscription":"/event/LoginEventStream__e"
> "error":"{color:#de350b}403:denied_by_security_policy:create_denied{color}"
> "successful":false|
> |
> |salesforce:/event/CustomEvent?replayId=-1|/event/CustomEvent__e|"subscription":"/event/CustomEvent__e",
> "successful":true|
> |
> |salesforce:/event/CustomEvent__e?replayId=-1|/event/CustomEvent__e|"subscription":"/event/CustomEvent__e",
> "successful":true|
> |*Suggested
> Approach*|salesforce:/event/LoginEventStream?replayId=-1|/event/LoginEventStream|"subscription":"/event/LoginEventStream"
> "successful":true|
> |
> |salesforce:/event/CustomEvent__e?replayId=-1|/event/CustomEvent__e|"subscription":"/event/CustomEvent__e",
> "successful":true|
>
> To receive the result described in the suggested approach, I removed channel
> suffix hardcoding from SubscriptionHelper.getChannelName
> {noformat}
> static String getChannelName(final String topicName) {
> final StringBuilder channelName = new StringBuilder();
> if (topicName.charAt(0) != '/') {
> channelName.append('/');
> }
> if (topicName.indexOf('/', 1) > 0) {
> channelName.append(topicName);
> } else {
> channelName.append("topic/");
> channelName.append(topicName);
> }
>
> /*
> * suffix hardcoding for event channels is removed
> */
> return channelName.toString();
> }{noformat}
>
> [Pull request|https://github.com/apache/camel/pull/4045]
--
This message was sent by Atlassian Jira
(v8.3.4#803005)