无法从 restforce 订阅 API_VERSION 48 的 salesforce



>我目前正在订阅 2 个主题,一个用于帐户,另一个用于联系人。我能够成功地使用 api_version 26(restforce 使用的默认版本(订阅这两个主题,但我没有收到使用此api_version删除操作的事件。
使用的宝石:

gem 'cookiejar', git: 'https://github.com/MissionCapital/cookiejar.git'  
gem 'faye', '0.8.9'
gem 'restforce', '~> 4.2.2'

法典:

@client = Restforce.new(username: ENV['SF_USERNAME'],
password: ENV['SF_PASSWORD'],
security_token: ENV['SF_SECURITY_TOKEN'],
client_id: ENV['SF_CLIENT_ID'],
client_secret: ENV['SF_SECRET_ID'])

推送主题

@client.create!('PushTopic',
ApiVersion: '48.0',
Name: ENV['CONTACT_PUSH_TOPIC_NAME'],
Description: 'all contact records',
NotifyForOperations: 'All',
NotifyForFields: 'All',
Query: 'select Id, FirstName, LastName, Title, Email, Phone, MobilePhone, OtherPhone, AccountId, OwnerId, IsDeleted from Contact')

这导致客户端处于26.0销售队伍的版本。

现在,更改为 salesforce api_verison48.0

@client = Restforce.new(username: ENV['SF_USERNAME'],
password: ENV['SF_PASSWORD'],
security_token: ENV['SF_SECURITY_TOKEN'],
client_id: ENV['SF_CLIENT_ID'],
client_secret: ENV['SF_SECRET_ID'],
api_version: '48.0')

推话题

@client.create!('PushTopic',
ApiVersion: '48.0',
Name: ENV['CONTACT_PUSH_TOPIC_NAME'],
Description: 'all contact records',
NotifyForOperationCreate: 'true',
NotifyForOperationUpdate: 'true',
NotifyForOperationDelete: 'true',
NotifyForOperationUndelete: 'true',
NotifyForFields: 'All',
Query: 'select Id, FirstName, LastName, Title, Email, Phone, MobilePhone, AccountId, OwnerId, IsDeleted from Contact')

对于此客户端,它不会接收任何事件。 不适用于任何操作(创建、更新或删除(。

在 Github 上提交的问题。 链接: https://github.com/restforce/restforce/issues/537

答:我们需要使用replay来处理更高版本。它不会在没有重播的情况下订阅。

EM.run do
@client.subscription "/topic/topicName", replay: -2  do |message|
puts message["sobject"]
end
end

相关内容

最新更新