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 

Spring 12 setup, no update events

I am using the sample java program and the Spring 12 api definition to by 'production' org.

 

I created a pushTopic,

ushTopic pushTopic = new PushTopic();
pushTopic.Name = 'updatedProblem';
pushtopic.Query = 'SELECT Id, Name, Description__c FROM Problem__c';
pushTopic.ApiVersion = 24.0;
pushTopic.NotifyForOperations = 'Update';
pushTopic.NotifyForFields = 'All';
insert pushTopic;

 

my java client is a cut/paste of the one in the api guide

http://www.salesforce.com/us/developer/docs/api_streaming/api_streaming.pdf#event_notification_rules_intro

 

I get

Running streaming client example....
Login successful!
Endpoint: https://na1-api.salesforce.com
Sessionid=00D30000000jo9e!AQQAQEbJr3rM1vgwppitYURcIplikvmta8l5u__5T7gmedcBDEctGGoRs262NxS7NzCet8jVIZLSExOaQZ0Ph6Xa5VBC4rP6
Waiting for handshake
[CHANNEL:META_HANDSHAKE]: {"id":"1","minimumVersion":"1.0","supportedConnectionTypes":["long-polling"],"successful":true,"channel":"/meta/handshake","clientId":"31dcwirt5psp2c12frbcxjofwtu","version":"1.0"}
[CHANNEL:META_CONNECT]: {"id":"2","successful":true,"advice":{"interval":0,"reconnect":"retry","timeout":110000},"channel":"/meta/connect"}
Subscribing for channel: /updatedProblem'
Waiting for streamed data from your organization ...
[CHANNEL:META_SUBSCRIBE]: {"id":"4","subscription":"/updatedProblem'","successful":true,"channel":"/meta/subscribe"}
[CHANNEL:META_CONNECT]: {"id":"3","successful":true,"channel":"/meta/connect"}

 

I edit an existing 'Problem' record, (I have disabled the trigger I created for this object) press save

 

nothing..

 

I have notify set to All

 

from the doc: (emphasis mine)

NotifyForFields Set to All
When you set the value of PushTopic.NotifyForFields to All, a change to any field value in the record causes the
Streaming API matching logic to evaluate the record to determine if a notification should be generated. Changes to record
field values cause this evaluation whether or not those fields are referenced in the PushTopic query SELECT clause or WHERE
clause.

 

I do see the cycle thru the read timeout and reconnect

Best Answer chosen by Admin (Salesforce Developers) 
VM_SFDCVM_SFDC

Again, I logged into your org. Repeated the same steps. After my client was handshook, subscribed and connected (waiting for data), I went to the UI, into the "Problems" tab. Went to the record I created yesterday and updated it. My client received the streaming event immediately:

 

### Received Streaming Event on [/topic/updatedProblem]: {"data":{"sobject":{"Name":"123460","Id":"a0O30000009JfOoEAK","Description__c":"create by vinod from salesforce.com; mod2 from UI"},"event":{"type":"updated","createdDate":"2012-02-17T23:35:34.000+0000"}},"channel":"/topic/updatedProblem"}
[CHANNEL:META_CONNECT]: {"id":"8","successful":true,"channel":"/meta/connect"}

 

Yesterday I had tried the record modification with API in your org and that worked too. So there is no reason why it would not work for you.


--Vinod.

All Answers

sammydsammyd

is there a way to debug this on the org side? can I put debug logging on and see anything?

 

does my org have to be 'enabled' for the events to flow?

 

thanks

sammydsammyd

any ideas on debuging no events?

 

 

VM_SFDCVM_SFDC

Apologies for the delay. We'll help you out.

 

You have:

query = 'SELECT Id, Name, Description__c FROM Problem__c'

NotifyForFields = 'All';

 

So it should get all field updates.

 

Questions:

1. What field type are you modifying? Note that tracking updates on large text area fields are not supported. Also the field needs to be queryable and editable in the API.

2. Does the subscriber (streaming user) has sharing access to the records being modified?

 

If you give Salesforce Login-Access as one of the streaming user, we will be able to help out quickly.

 

Thanks!

Vinod.

(Salesforce.com)

 

 

 

greentruck55greentruck55

I tried changing a select list numeric field (priority)

and also tried changing a short text field (description)..

 

these chnages caused updates on the preview to my dev org..

but this is a special limited production type org I am working with now. (only place where this object exists)..

 

yes I am using an admin userid which has full authority to the record. (user and api logged in concurrently  with the same credentials)

 

I don't know how to do the last thing.. don't know what u are asking for..

 

I forwarded the java source code to my SF sales contact. he gets events thru the workbench on my pushtopics.

so its gotta be something small.

 

Sam

VM_SFDCVM_SFDC

Let me know if you still cannot get it to work.

 

To grant login access:

 

https://login.salesforce.com/help/doc/en/granting_login_access.htm

 

Thanks!

Vinod.

 

(Salesforce.com)

greentruck55greentruck55

how do I contacgt u with the org info? it is not my dev org

 

VM_SFDCVM_SFDC

I know your org id. So just let me know when login access is granted.

 

Thanks!

Vinod.

VM_SFDCVM_SFDC

I went to your org and I see the grants for login access. I see 5 topics (3 on case and 2 on Problem__c). Which topic do you want me to try? and which fields do you want me to check updates on?

VM_SFDCVM_SFDC

Oh I see you were having problems with "updatedProblem". I'll try that. Is it ok if I create a test record in your org and experiement with that?

 

Thanks!

Vinod.

VM_SFDCVM_SFDC

I subscribed to "/topic/updatedProblem" as the System Administator (S.D.). I was able to get both create and update (updates to description__c) in my java client (code similar to the java sample that is published in the doc).

 

[CHANNEL:META_HANDSHAKE]: {"id":"1","minimumVersion":"1.0","supportedConnectionTypes":["long-polling"],"successful":true,"channel":"/meta/handshake","clientId":"11qo0fx76sx2crtme9uax189l","version":"1.0"}
    ########### received cookie: sfdc-stream=2103304714.38175.0000; expires=Fri, 17-Feb-2012 01:43:51 GMT; path=/cometd

 

### Received Streaming Event on [/topic/updatedProblem]: {"data":{"sobject":{"Name":"123460","Id":"a0O30000009JfOoEAK","Description__c":"create by vinod from salesforce.com; mod1"},"event":{"type":"updated","createdDate":"2012-02-16T22:52:22.000+0000"}},"channel":"/topic/updatedProblem"}
[CHANNEL:META_CONNECT]: {"id":"9","successful":true,"channel":"/meta/connect"}

So the problem must be in the client code.

 

--Vinod.

greentruck55greentruck55

try problem 123457..

 

I am in between planes, will post my source in the morning..to my org its the sample code in the spring 12 api reference..

 

change the priority field

sammydsammyd

posted source in the streamingsource.zip in the streamingsource library

 

this is the direct sample in the new reference quide (cut/pasted) with my changes.

 

there are two topics

 

updateproblem   - selective fields

and updateproblem1 - all fields

 

I see

 

Running streaming client example....
Login successful!
Endpoint: https://na1-api.salesforce.com
Sessionid=00D30000000jo9e!AQQAQOqgsUaR.iTL66QyvBXWO0TNfrxT2ahE0RBPS7FtRtZKfWBpXQqpLJ7zolD9s0noK9MmzrGIK.0uJdEdvTl3Ow4sEQN6
Waiting for handshake
[CHANNEL:META_HANDSHAKE]: {"id":"1","minimumVersion":"1.0","supportedConnectionTypes":["long-polling"],"successful":true,"channel":"/meta/handshake","clientId":"11tqzse51jcfrx1hdjjwo8pkn5z","version":"1.0"}
[CHANNEL:META_CONNECT]: {"id":"2","successful":true,"advice":{"interval":0,"reconnect":"retry","timeout":110000},"channel":"/meta/connect"}
Subscribing for channel: /updatedProblem
Waiting for streamed data from your organization ...
[CHANNEL:META_SUBSCRIBE]: {"id":"4","subscription":"/updatedProblem","successful":true,"channel":"/meta/subscribe"}
[CHANNEL:META_CONNECT]: {"id":"3","successful":true,"channel":"/meta/connect"}

 

I don't see anything really different from the preview code which worked (on my developers org)

 

sammydsammyd

still see no change notices

 

VM_SFDCVM_SFDC

I looked into the logs during the timeframe you posted last message. I see handshake, connect, subscribe and further connect messages from you. But nothing else. This tells me the events were not even produced. The way you are modifying the records are not producing events. Can you describe exactly how you modify records. Note that the streaming client gets only current events. Not something which happenned in the past. So following should work:

 

1. handshake()

2. subscribe() to the topic

3. connect()

4. modify a record which matches the query in the topic

5. client should receive events.

 

I see #1, #2, and #3, but not #4 in the logs for you.

 

If you describe exactly how you do #4 I will try to repro.

 

-Vinod.

VM_SFDCVM_SFDC

Again, I logged into your org. Repeated the same steps. After my client was handshook, subscribed and connected (waiting for data), I went to the UI, into the "Problems" tab. Went to the record I created yesterday and updated it. My client received the streaming event immediately:

 

### Received Streaming Event on [/topic/updatedProblem]: {"data":{"sobject":{"Name":"123460","Id":"a0O30000009JfOoEAK","Description__c":"create by vinod from salesforce.com; mod2 from UI"},"event":{"type":"updated","createdDate":"2012-02-17T23:35:34.000+0000"}},"channel":"/topic/updatedProblem"}
[CHANNEL:META_CONNECT]: {"id":"8","successful":true,"channel":"/meta/connect"}

 

Yesterday I had tried the record modification with API in your org and that worked too. So there is no reason why it would not work for you.


--Vinod.

This was selected as the best answer
sammydsammyd

I don't see the object u created.

 

the other pushtopic, updatedProblem1 is 

 

select id, name, Severity__c, Description__c from Problem__c

 

All, Update

 

so ANY field change should fire an event..

 

again, please try problem 123457, and change the priority field. its a drodown..

or type in the status or description short text fields..

or set the DefectSystemNumber__c

sammydsammyd

Hi sammyd,

 

Would you mind posting your code for creating the pushTopic? Specifically, what the name of the topic is and the API version of the sobject. Also, which salesforce instance is your org on?

 

Best,


Aleks S.

SFDC

 

------------------ reply

 

I cut/pasted from the api ref into the dev console.

 

PushTopic pushTopic = new PushTopic();
pushTopic.Name = 'updatedProblem';
pushtopic.Query = 'SELECT Id, Name, description__c From Problem__c';
pushTopic.ApiVersion = 24.0;
pushTopic.NotifyForOperations = 'Update';
pushTopic.NotifyForFields = 'All';
insert pushTopic;

 

I had code working on the preview.. and it used the Oauth login.. this sample SFDC provided uses the SoapLogin

 

old code from prior app

 String url = LOGIN_SERVER + "/services/oauth2/token";

        ContentExchange exchange = new ContentExchange();
        exchange.setMethod("POST");
        exchange.setURL(url);
System.out.println("secret="+CLIENT_ID+" username="+USERNAME+" password="+PASSWORD);
        String message = "grant_type=password&client_id=" + CLIENT_ID
                + "&client_secret=" + CLIENT_SECRET+ "&username=" + USERNAME
                + "&password=" + PASSWORD + "&format=json";

 new code from new sample

HttpClient httpClient = new HttpClient();
			httpClient.setConnectTimeout(CONNECTION_TIMEOUT);
			httpClient.setTimeout(READ_TIMEOUT);
			httpClient.start();
			String[] pair = SoapLoginUtil.login(httpClient, USER_NAME, PASSWORD);
			if (pair == null) {
				System.exit(1);
			}
			assert pair.length == 2;
			final String sessionid = pair[0];
			String endpoint = pair[1];
			System.out.println("Login successful!\nEndpoint: " + endpoint
					+ "\nSessionid=" + sessionid);
			Map<String, Object> options = new HashMap<String, Object>();
			options.put(ClientTransport.TIMEOUT_OPTION, READ_TIMEOUT);
			LongPollingTransport transport = new LongPollingTransport(
					options, httpClient) {

 

 

My org is on na1

https://na1.salesforce.com

sammydsammyd

Ok, I've found the problem..

 

1. altho u create topic, name 'x', the thing the code LISTENS on is '/topic/x'

2. I couldn't get this to work..

3. there was a typo in the cut/paste of the sample  where a trailing SINGLE quote was left over in the topic name

    "/topic/updatedProblem1'"

    so, this failed to subscribe, duh.. but I didn't see it, so I changed the code to subscribe to '/updatedProblem1' which succeeded but no events will ever fire for that (incorrect) topic.

 

thanks for the event output of your code.

 

I think this demonstrates a bug.. The subscribe should have failed with invalid channel with the api version set to 24 and the topic without the leading '/topic' string.

 

thanks again for your time.

sammydsammyd

also, now looking at my use case, from a usability, performance, and system performance impact level, it sure would be nice to have an option when NotifyForFields=all   tell me which fields changed. not the fields in the select statement.

 

I have a 100 fields in the object. I NEED to drag them all down to the client (consuming SF cycles to collect & send unused data) because my client app needs ALL the fields for the workflow it as to do.   If there was a list of field and new contents, this would save work on all sides..

 

but.. short term I can deal with this.