I'm writing a web application which updates objects in SAP BO. It works perfect except it's taking forever to setup the connection to SAP and update the objects. So I thought to create a background thread to handle the update to SAP while the active thread can continue processing the current request. But it appears not to be as easy as this. I'm no expert on writing multi threaded code but the few multi threaded methods I wrote work just fine.
This is what I try to do: on the website a user can change his phone number. The web app saves this 'change' in a database. Just after it is saved in the database a new thread is started. This background thread checks the database and pickes up all pending changes and tries to push them to SAP. The code works when don't try to run it in a background thread. When I run it in a background thread I can step through the code with the debugger until the line company.Connect(). This normaly takes a while before I can step to the following line in code, but instead it quits debugging. It looks like the thread is killed when a response is send back from SAP.
Does anyone managed to get a similar solution working and can push me in the right direction?
I know I can write for example a windows service which does just what the background thread is doing, but this means you have to install a windows service on the webserver. Thats what I trying to avoid for multiple reasons.