Business Rules Authorization Tool Updated, Funky Problem With Custom Promoted Property
Just finished up a week-long POC for one of my favorite accounts up in north LA. Now that I have 6 spare minutes, wanted to post an update to my Business Rules Authorization Manager tool and note a really random BizTalk thing I came across this week.
I cleaned up the Rules Authorization Manager a bit, adding support for securing vocabularies as well as rule sets, and, actually adding exception catching code. Some people actually like their exceptions handled. Go figure. You can download the RAM tool here.
My POC this week consisted of getting duplicate records out of Siebel, processing them, making recommendations on which ones to keep (using Business Rules) and then making a final update to Siebel. Fun stuff. Since each SQL Adapter query grabbed a individual group of duplicates, I needed some way to know when all the duplicates had been yanked. I didn't want to process all the duplicates via a singleton orchestration, but rather spread the processing out. So, I implemented a variation of the Scatter-Gather pattern where I process each cluster of duplicates asynchronously, but then when that cluster is done, I throw the message direct bound to the MessageBox. Then, I have a simple singleton convoy orchestration who just listens for the clusters and if a minute has passed (using combination of loop shape, listen shape, delay shape), then I assume I've got all the clusters and move on to the next process step. Now, that's not foolproof, and for a *real* application I'd probably want a better validation (e.g. database counter) that all the clusters have been received instead of a simple timer.
That all said, I needed a way for the "Gather" orchestration to only subscribe to completed cluster of duplicates. And the schema I used was generated by SQL Server, so I didn't want to muck around with the database to add some sort of "status" flag. SO what I did was create a simple receive pipeline component that created a new promoted property called "ClusterStatus" and defaulted it to "Processing". Now I have a promoted field that the singleton orchestration can subscribe on. Each processing orchestration then sets the "ClusterStatus" to "Completed" before dumping it back to the MessageBox for the singleton to pick up. HOWEVER, when I started it up, my processing orchestrations all barfed and said "no subscribers found" when calling the direct bound send shape. After digging around, I saw that my promoted property "ClusterStatus" was still in my outbound message, but had gotten demoted to context-only. Ugh! I broke down and engaged the wisdom of Marty Waz, and he suggested creating a correlation set, and initializing on that direct bound send back to the MessageBox. Brilliant. This forces the context value back into a promoted state, and now the singleton could see it.
Not sure anyone will ever have this problem, but it drove me nuts, and this was a bizarre yet logical way to fix my problem.
Technorati Tags: BizTalk