Salesforce streaming api client for asyncio
aiosfstream的Python项目详细描述
气流
aiosfstream是asyncio的Salesforce Streaming API客户端。它可以 用于接收有关Salesforce对象更改的推送通知,或 通过Streaming API发送的一般事件通知
有关如何使用PushTopics或如何使用PushTopics的详细指导 要创建Generic Streaming Channels请参考 Streaming API documentation。 用于处理Platform Events或 Change Data Capture events查看链接的 文档。
功能
- 支持的身份验证类型:
- 使用用户名和密码
- 使用刷新标记
- 支持durable messages and replay of events
- 从重播错误中自动恢复
使用量
importasynciofromaiosfstreamimportSalesforceStreamingClientasyncdefstream_events():# connect to Streaming APIasyncwithSalesforceStreamingClient(consumer_key="<consumer key>",consumer_secret="<consumer secret>",username="<username>",password="<password>")asclient:# subscribe to topicsawaitclient.subscribe("/topic/one")awaitclient.subscribe("/topic/two")# listen for incoming messagesasyncformessageinclient:topic=message["channel"]data=message["data"]print(f"{topic}: {data}")if__name__=="__main__":loop=asyncio.get_event_loop()loop.run_until_complete(stream_events())
变更日志
0.5.0(2019-03-08)
- 添加对更改数据捕获事件的支持
- 修复文档中的一些错误
0.4.0(2019-01-06)
- 添加类型提示
- 可配置的重播存储行为
0.3.0(2018-11-07)
- 添加对沙盒组织的支持
0.2.5(2018-11-06)
- 添加缺少的更改日志条目
0.2.4(2018-11-06)
- 修复平台事件消息创建日期提取问题
0.2.3(2018-09-19)
- 修复Python3.7中的异步迭代器错误
0.2.2(2018-06-15)
- 将aiocometd依赖项更新为0.3.1
0.2.1(2018-05-25)
- 修复批量记录删除操作中的重播问题
- 改进client.publish方法的文档
0.2.0(2018-05-05)
- 启用第三方json库的使用
- 在authenticator类中将身份验证结果公开为公共属性
0.1.0(2018-04-26)
- 支持的身份验证类型:
- 使用用户名和密码
- 使用刷新标记
- 订阅并接收有关的消息:
- 支持durable messages and replay of events
- 从重播错误中自动恢复