
If you are building your own custom job, you do not have to plug-in to Job Processor if you don’t want to. The job queue can be accessed through the Vault web services API, just like with files and folders.
The recommended approach is to use Job Processor. That approach is what you see in the SDK documentation and sample apps. But the Job Processor can’t handle all the cases. There are some times when you may want to just write your own service. This article will help you identify those cases and provide some help writing the code.
First let’s talk about what Job Processor does well. It’s a single application than can handle multiple job types. It has various job handlers loaded out-of-the box, and additional functionality can be plugged in. For a Vault admin, this is good because everything can be managed from a single app. If something goes wrong, there is only one place to look, one log file to check, and so on. From the developer's point of view, Job Processor offers some nice features. You don’t have to worry about Vault authentication, managing the job queue and logging. None of these things are very hard, but it’s nice to have the app take care of them.
On the flip side, Job Processor does have some limitations. First, it’s not a true Windows service. A user has to log in, launch the app, and leave it running. Job Processor handles jobs one at a time. There is no parallel processing. And you can only run a single process on a machine. A common problem is that Job Processor gets bogged down with jobs that take a long time, like DWF generate jobs. This prevents other types from running even if they take less time to run.
If you are running in a multi-site environment, Job Processor can only process jobs from one site. Vault requires that a job can only be handled by the site that queued it. So if you have 5 sites queuing jobs, you would need 5 Job Processors running.
By communicating directly with the job queue you can bypass these limitations and build exactly the app you want. Working with the job queue is easy. You just need to use the following functions from the JobService:
- ReserveNextJob - This grabs a job and reserves it to you so that nobody else works on it. You pass in the job types you support and Vault passes back the “next” job based on the priority and the time it was queued.
- UpdateJobSuccess - This tells Vault that you are done with the job, and it can be removed from the queue.
- UpdateJobFailure - This tells Vault that something went wrong. The job stays on the queue in the error state. You can pass back information on what went wrong.
- UnReserveJobById - This function is used for cases where a job gets reserved but never updated. For example, maybe the service crashed or there was a power outage.
If you want an example, have a look a Q-Tools. It’s a Windows service that can interact with queues from multiple Vault sites.













Subscribe
The post-AU blog article
AU is now over, and I’m almost fully recovered. My limp is barely noticeable and my right eye is mostly in focus. It will take a few more weeks for the slot-machine ringing noises to fade away, but that’s to be expected. This is a good time to go over Vault API related topics from AU.
Vault wins at Apphack
Autodesk Developer Network put on an event called Apphack. The idea is that people could submit their apps, and the public votes on which one should win. I think there were around 20 entries. The winning entry was a Vault App!
Rob Oud from CAD & Company submitted Vault Project Portfolio. It’s a Vault Browser app for Windows 8 tablet. I was able to see a quick demo between classes, and the app looks very cool.
My classes were not recorded, again
Every year a rumor goes around that every class will be recorded, and every year it turns out to be a lie. I don’t think I’ve ever had an AU lecture recorded.
Anyway, my two classes “Programming Integrations Between Autodesk Vault and Other Systems” and “Programming Custom Objects with the Autodesk Vault API” will be converted into blog posts over the next few months. It’s probably for the best anyway. You can’t Google for content within a video very well.
Process is critical
I like to attend as many Vault classes as I can. Mainly I just sit and listen. One common theme this year was process. If you don’t get your processes defined properly, your Vault deployment will be a failure. That got me to thinking what I usually think about: Can I write any apps for this?
It’s a bit of a “chicken and the egg” problem. How can I write a Vault app that helps with Vault deployment? Any suggestions would be welcome.
Posted at 10:51 AM in Commentary | Permalink | Comments (1) | TrackBack (0)