Call an eSpace action inside an extension

Call an eSpace action inside an extension

  
Hi,

It is possible to call an eSpace action inside a thread created in an extension.

I can call an action of an eSpace inside the extension, but when i try to creat a thread and then call the same action it gives an error "Object not set to an instance on an object" in the HEContext.

What i want to do is call an action of an eSpace that takes to long to complete, without using timers.

I try to create a new thread, call the action in that thread an let it running but it gives that error.

Any ideas to resolve this issue?

Thanks in advance,

The problem seems to be when i try to acess a siteProperty or a Session Variable on the eSpace.

If i call an action that don't use sitePropertys or Session Variables it works, but when i call an action that uses sitePropertys or Session Variables it gives me the error: "Object not reference to an instance of an object".

It is possible to call an action that acess to sitePropertys or Session variables inside a thread?

Thanks,


Gonçalo Lopes 

Hi Gonçalo,

Spawning a new thread and using it to call eSpace actions is not supported. This has to do with the fact that eSpace actions will often need information regarding the current request (even if just for internal operations) and the new thread will not be bound to the context of the request. Therefore I'd suggest that you follow a different approach to accomplish your goal.

You say you want to perform a long operation without using timers. It would work to have an entry point or webscreen available that would perfom that action and have the spawned thread to call that URL setting the request timeout to a very large timespan. The thread would not need the httpcontext as it would not be invoking the eSpace's actions, and the called URL would have a working thread with a context of its own.

The main point here is:
  • should you need to perform long running actions regarding your eSpace, use long-running requests either through timers, AJAX calls or asynchronously calling some entry point on your eSpace by some other method
  • should you need to perform long running actions that don't regard your eSpace (running system processes or something else asynchronously) you may spawn a new thread (or process) and leave it handling that action
I hope this helps