Closed avinkris closed 5 years ago
Hi @avinkris
I see that in the code example you provided, you were trying to hide all your authentication credentials. Which is fine, but I suspect that you've also changed the name of the channel you're subscribing to. I would need to know the exact name of the channel.
You can use the library to subscribe to PushTopics (the channel names start with the /topic/
prefix), to subscribe to Generic Streaming Channels (the channel names start with the /u/
prefix) or to subscribe to Platform Events (the channel names start with the /event/
prefix).
As far as I know, there is no entity on the Salesforce platform for which the name of the channel would start with a /data/
prefix. So are you trying to stream events from PushTopcis or from Generic Streaming Channels or Platform Events?
You mentioned that after you made a change on Salesforce the code example stopped working. What did you change exactly?
Hi @robertmrk , I am trying to subscribe to Change Data Capture events in Salesforce. The change I made was to a record that belongs to the Case object. I haven't changed the channel, I used it as per this documentation https://developer.salesforce.com/docs/atlas.en-us.api_streaming.meta/api_streaming/code_sample_java_add_source.htm please scroll down to the channel parameter.
Oh, I see. This is a totally new addition to the platform, it's was introduced in v44.0 These types of events are not yet supported by the library.
I'll make the necessary changes to be compatible with them in the next few days.
Hi @avinkris
I implemented the necessary changes in a feature branch. You can install it by running the following command:
pip install -e git+https://github.com/robertmrk/aiosfstream.git@feature/change-data-capture-events#egg=aiosfstream
Can you confirm that your application works correctly if you install aiosfstream with the above command?
Hi @robertmrk ,
It is working now, I have received the payload
{'data': {'schema': 'vgsSoaoxU_cvltYFCwvDdg', 'payload': {'LastModifiedDate': '2019-03-07T20:28:26.000Z', 'Status': 'New', 'ChangeEventHeader': {'isTransactionEnd': True, 'commitNumber': 140727112603, 'commitUser': '005200000023W9BAAE', 'sequenceNumber': 1, 'entityName': 'Case', 'changeType': 'UPDATE', 'changeOrigin': '', 'transactionKey': '001eaeee-db03-9e4a-03ab-003e02aa68ea', 'commitTimestamp': 1551990501000, 'recordIds': ['5001000000qHA4NAAW']}, 'SEL_Status__c': 'New'}, 'event': {'replayId': 19605}}, 'channel': '/data/ChangeEvents'}
Thank you very much for the prompt response, great work! :)
You're welcome! The fix will be included in the next release.
Hi Robert,
I am new to Python and APIs, after lot of struggle I managed to find your package and written this
` import asyncio
from aiosfstream import SalesforceStreamingClient
async def stream_events():
connect to Streaming API
if name == "main": loop = asyncio.get_event_loop() loop.run_until_complete(stream_events()) `
Sorry I am unable to get this code block working for the above code.
After making a change in Salesforce I am getting the below error.