简体   繁体   中英

SalesForce Mule connector v10.13.0 on CloudHub subscribing event multiple times

I have implemented an API on the CloudHub platform, in a Mule application deployed on 2 Workers on Mule 4.3.0 runtime. This Mule application is listening to a Salesforce event using subscribe-channel-listener, and in Studio, I have enabled it to run on Primary Node only.

<salesforce:sfdc-config 
   name="Salesforce_Config" 
   doc:name="Salesforce Config" 
   doc:id="55f5d9c0-0fa3-4e14-a8fe-6cc6a2c3a09b" >
   <salesforce:oauth-user-pass-connection 
      username="${secure::sf.username}" 
      password="${secure::sf.password}" 
      securityToken="${secure::sf.token}" 
      consumerKey="${secure::sf.consumerKey}" 
      consumerSecret="${secure::sf.consumerSecret}" 
      tokenEndpoint="${secure::sf.tokenEndpoint}"/>
</salesforce:sfdc-config>

<salesforce:subscribe-channel-listener 
   doc:name="Subscribe channel listener" 
   doc:id="e0f47684-d458-46c9-b7c7-13399ca5af39" 
   config-ref="Salesforce_Config" 
   streamingChannel="${sf.streamingChannel}">
   <reconnect />
</salesforce:subscribe-channel-listener>

Issue: We have detected that this Mule Salesforce connector subscribes to the event 2 times, on each worker. This didn't happen just once, we re-tried again after a few minutes, and again it duplicated the even on each worker.

As we are running our APIs on CloudHub, please can someone advise me a better solution so that we never duplicate the subscribed events?

I had faced the same issues and raised the support ticket with Mulesoft Support, and they suggested to me that for salesforce events, always use a single worker.

My application was also on CloudHub.

more inofrmation is here (this link is given by support team to me) - https://docs.mulesoft.com/salesforce-connector/10.14/salesforce-connector-processing-events

there is clearly mentioned that "If you use multiple workers when running the app in CloudHub, all of the workers receive and process the events."

and in Studio, I have enabled it to run on Primary Node only.

If the issue is that the event is being subscribed in both workers, then that should be expected. Studio can be configured to execute simulating a single node cluster, however CloudHub doesn't deploy to a cluster, but to multiple independent nodes (workers). Hence there is no primary node in CloudHub, all nodes are equal. The solution is to deploy to a single node as Anurag Sharma mentioned.

If you need a full explanation there is a KB article (which I found after writing above answer) in MuleSoft Help Center: https://help.mulesoft.com/s/article/Why-Salesforce-Connector-set-primary-node-for-replay-channel-does-not-work-on-Cloudhub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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