5

I have my .NET client (windows service) which subscribes to Salesforce streaming API push topics.

I am able to connect to Salesforce and can get the notifications to my client. Everything is working fine, but:

When there is no activity on the channel (no changes for Salesforce object) after some time (maybe 2 hours) if I update the object, I am not receiving any notification from Salesforce.

I had tried putting listeners to log and in the logs it says below

{"clientId":"f6xo67iet55w5j7ek6ldw72nfc6","channel":"/meta/connect","id":"82","successful":true} 5/15/2018 8:12:28 PM

{"advice":{"interval":0,"reconnect":"handshake"},"channel":"/meta/connect","id":"83","error":"403::Unknown client","successful":false} 5/15/2018 8:12:28 PM

{"clientId":"hbx1v2cxebbeder11s99dqkxmasre","advice":{"interval":0,"timeout":110000,"reconnect":"retry"},"channel":"/meta/connect","id":"85","successful":true} 5/15/2018 8:12:29 PM

{"clientId":"hbx1v2cxebbeder11s99dqkxmasre","channel":"/meta/connect","id":"86","successful":true} 5/15/2018 8:14:20 PM

{"clientId":"hbx1v2cxebbeder11s99dqkxmasre","channel":"/meta/connect","id":"87","successful":true} 5/15/2018 8:16:10 PM

so as per the log, sometimes I get "403::Unknown client" but immediately after that it says again channel successful.

But as I said when I try updating the Salesforce object after 2 hours (as per log, it is in connection successful) I am not receiving any notification.

If I restart my windows service and gets the notification again.

In my client I am using cometd from - https://github.com/couchand/CometD.NET/tree/headers and for push topics subscription I am using this - https://github.com/foluis/Salesforce_PushTopics

Any help would be greatly appreciated.

4

1 回答 1

3

好吧,我终于可以让这个工作了。以下是改动

  1. 只要有“403::Unknown client”,CometD 就会尝试重新连接(cometd 的默认行为)
  2. 一旦重新连接,所有频道订阅都将被删除(这是 cometd 所做的,它的默认行为)
  3. 所以,解决方案是,我们总是需要在“元/握手”回调中进行频道订阅。这甚至是 cometd.org 也建议这样做。
  4. 这将确保在每个握手通道上都是同步的
  5. 完成此操作后,即使我们没有从 salesforce 更新任何对象,然后在 2 天后尝试它仍然有效,我的 salesforce 同步工作正常。
于 2018-05-22T08:05:18.487 回答