VMware {code} Community
mlawson
Enthusiast
Enthusiast

multi-threaded processes calling the api

Is it possible to make multi-threaded processes work with the API? i have a process that creates a Vapp using a VappTemplate, but it takes a very long time if i want to create several Vapps.

I tried to call my process using a multi-threaded approach, but i kept getting errors about malformed XML documents:

There is an error in XML document (1, 1).

0 Kudos
4 Replies
mlawson
Enthusiast
Enthusiast

or... if there is a way via the .net sdk to create multiple vapps at the same time?

0 Kudos
admin
Immortal
Immortal

It is not a problem to use the API itself from several threads. I don't know how the sdk is implemented though.

You just need to be careful about the objects being busy. If an object is in 'busy' state it may not be able to perform some operations - you will probably need to wait for its tasks to complete.

0 Kudos
mlawson
Enthusiast
Enthusiast

thanks for the reply. i believe i am correctly waiting for each task to complete before refreshing the object and performing the next task, as it is all working correctly when i do this with a single thread... it's only when i try using a multi threaded approach does it fail and give the error above.

0 Kudos
admin
Immortal
Immortal

This is probably due to the internal implementation of the SDK - try using different sessions (same user) in each thread - this might help.

0 Kudos