Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-15338

Salesforce - Wrong Channel Name for Standard Platform Events

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.4.2
    • Fix Version/s: 3.4.3, 3.5.0
    • Component/s: camel-salesforce
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      For channels starting with "/event/" "__e" suffix is always added to the channel name in SubscriptionHelper.

       

      However, according to salesforce documentation API names of standard platform events, such as AssetTokenEvent, don't include a suffix.

       

      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":"403:denied_by_security_policy:create_denied"
      "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

      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();
      }

       

      Pull request

        Attachments

          Activity

            People

            • Assignee:
              acosentino Andrea Cosentino
              Reporter:
              Yullia.buzlukova Yulia Buzlukova
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: