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
sfnoobsfnoob 

WSC and multi-threaded questions

Step 1. connection = new EnterpriseConnection(ConnectorConfig) <-Peforms auth and gets session&auth

Step 2. connection.xyz() <- communicates direclty with endpoint with session

 

- Can step1 be performed in a thread and then have step2 be performed in multiple threads in parallel to do different tasks (assuming no logout() is called and session is not invalidated due to some  other reason)

 

- Is there a limit to number of times we can say new EnterpriseConnection(ConnectorConfig) and create new sessions?

 

- Is a better model to:

Step 1. connection = new EnterpriseConnection(ConnectorConfig) <-Peforms auth and gets session&auth

             sessionConfig = connection.getConfig();

Step 2. newConnectionInThread = new EnterpriseConnection(sessionConfig) <- doesn't perform auth again

             newConnectionInThread.xyz() <- communicates direclty with endpoint with session

 

Thanks.

max_overloadmax_overload

Your second presumption is the better one to use (essentially re-using the session retreived from your first authentication event). The first session token will die if you try and authenticate again so, your succession "threads" will die.

The platform will control threading for you when doing transactional work so, don't worry about that side of things.

 

This has been my experience when using and consuming the partner force.com wsdl...

 

Hope that helps.