function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sammydsammyd 

event time limit?

so, my app is working.. but I notice that sometimes after receiving the event, I add some more code and recycle the app,

and I get a recurrance of the event that just processed.

 

If I wait 3-5 minutes (not tracking time really), then I don't get a recurrance.

 

is there an event lifetime I need to think about?

 

Best Answer chosen by Admin (Salesforce Developers) 
VinodMVinodM

This is a cornercase bug. We'll fix it soon. Normally if you keep connected this should not happen. But in this case since you are recycling the client and starting with a fresh handshake again there is a chance you end up on a different appserver instance in our pods - which has slightly different view of things. It is an easy fix. We'll make it available in production soon. Thanks for finding it and bringing it to our attention.

 

Thanks!!

Vinod.

All Answers

gwestrgwestr

One way to ensure this can never happen is to do a new handshake and subscribe each time you are regenerating your code.  Another thing to note is that every message contains a sequential, unique ID field called "id" that has values like "1" "2" "3" that you can use to disambiguate responses.

 

Is this a client app or an in browser app?

sammydsammyd

I do a new handshake and subscribe on each startup of the app. but still see this duplicated event.

 

this is the sample Java code with my message handler added.

 

Sam

 

this is the typical startup and event message,

this happens every time I start the app up.

 

 

Login successful!
Endpoint: https://na1-api.salesforce.com
Sessionid=00D30000000jo9e!AQQAQM_iwVAgMPHLFPUgs5PlJMEDvC95qSNZoaq0riOUQY8j._CDQ.Iwk35NI9nYW9ydJJsxmH0AsUv6LFj.r0r.phIybHGr
Waiting for handshake
[CHANNEL:META_HANDSHAKE]: {"id":"1","minimumVersion":"1.0","supportedConnectionTypes":["long-polling"],"successful":true,"channel":"/meta/handshake","clientId":"11xew1pom16fn71j6tu8tdbyeii","version":"1.0"}
[CHANNEL:META_CONNECT]: {"id":"2","successful":true,"advice":{"interval":0,"reconnect":"retry","timeout":110000},"channel":"/meta/connect"}
Subscribing for channel: /topic/updatedProblem
Waiting for streamed data from your organization ...
[CHANNEL:META_SUBSCRIBE]: {"id":"4","subscription":"/topic/updatedProblem","successful":true,"channel":"/meta/subscribe"}
Received Message: {"data":{"sobject":{"Name":"123457","Id":"a0O30000002K79XEAS","Description__c":"testing on sfdc again"},"event":{"type":"updated","createdDate":"2012-03-02T13:14:49.000+0000"}},"channel":"/topic/updatedProblem"}
[CHANNEL:META_CONNECT]: {"id":"3","successful":true,"channel":"/meta/connect"}
[CHANNEL:META_CONNECT]: {"id":"5","successful":true,"channel":"/meta/connect"}
[CHANNEL:META_CONNECT]: {"id":"6","successful":true,"channel":"/meta/connect"}
[CHANNEL:META_CONNECT]: {"id":"7","successful":true,"channel":"/meta/connect"}
[CHANNEL:META_CONNECT]: {"id":"8","successful":true,"channel":"/meta/connect"}

 I don't see a sequence number on the event message

 

Received Message: {"data":{"sobject":{"Name":"123457","Id":"a0O30000002K79XEAS","Description__c":"testing on sfdc again"},"event":{"type":"updated","createdDate":"2012-03-02T13:14:49.000+0000"}},"channel":"/topic/updatedProblem"}

 

here is the event handler registration, and entrypoint  from the sample

 

            client.getChannel(CHANNEL).subscribe(new MessageListener() {
                public void onMessage(ClientSessionChannel channel, Message message) {
                    System.out.println("Received Message: " + message);

 



VinodMVinodM

This is a cornercase bug. We'll fix it soon. Normally if you keep connected this should not happen. But in this case since you are recycling the client and starting with a fresh handshake again there is a chance you end up on a different appserver instance in our pods - which has slightly different view of things. It is an easy fix. We'll make it available in production soon. Thanks for finding it and bringing it to our attention.

 

Thanks!!

Vinod.

This was selected as the best answer
sammydsammyd

thank you for the feedback! one more thing to worry about off the checklist.