Bookmark Options
-
Thursday, March 22, 2012 6:29 PM
We have an activity that creates bookmarks (multiple bookmarks) and unloads it. Later in the process these bookmarks are resumed by scheduler. Each bookmark is tagged with data time when it has to wake up and run the following activity on the workflow. There are different activity route a resumed activity can take from that bookmark point.
My biggest problem is when you have bookmark with MultipleResume like given below, all bookmarks must be resumed for the following activity to trigger.
// create bookmark that can be resumed multiple times
context.CreateBookmark(Convert.ToString(bookmarkID).ToLower(), new BookmarkCallback(Continue), BookmarkOptions.MultipleResume);
I need something like execute all bookmarks and treat each bookmark completion and follow the activity below.
This is also very useful where you can create checkpoint on your workflow (say for e.g, you create bookmark when somebody submits an payment) and for some reason if the workflow do not follow the intended path due to some configuration on database sync problems; you can actually resume that workflow from the checkpoint and you do not need to worry about executing it as a whole.
- Any clues?
All Replies
-
Tuesday, March 27, 2012 3:14 AMModerator
Hi,
I didn't fully understand you scenario. However, the BookmarkOptions enum is a flag so you can combine both NonBlocking and MultipleResume. That means you can resume the bookmark multiple times, and the bookmark won't block your activity from completing.
Leo Tang [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help. -
Wednesday, March 28, 2012 7:13 AMModerator
>need something like execute all bookmarks and treat each bookmark completion and follow the activity below.
Are you saying you want the 'next' activity after this one to execute every time a bookflow completes on this activity?
You can't quite do that, your activity can only
-schedule child activities.
-completeIf you want something to be triggered multiple times, once per bookmark, I'd advise making it into a child activity (or activity delegate) instead. Then you can schedule it from your bookmark callback.
Tim- Proposed As Answer by Tim Lovell-SmithModerator Wednesday, March 28, 2012 7:13 AM
- Marked As Answer by LeoTangModerator Thursday, April 05, 2012 8:00 AM
-
Wednesday, March 28, 2012 9:42 PM
Hi,
I didn't fully understand you scenario. However, the BookmarkOptions enum is a flag so you can combine both NonBlocking and MultipleResume. That means you can resume the bookmark multiple times, and the bookmark won't block your activity from completing.
Leo Tang [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.This code here runs the "activity" below one time when all the bookmark is resumed.
// create bookmark that can be resumed
// multiple times
context.CreateBookmark(Convert.ToString(bookmarkID), new BookmarkCallback(Continue), BookmarkOptions.MultipleResume & BookmarkOptions.NonBlocking);
-
Wednesday, March 28, 2012 9:43 PM
>need something like execute all bookmarks and treat each bookmark completion and follow the activity below.
Are you saying you want the 'next' activity after this one to execute every time a bookflow completes on this activity?
You can't quite do that, your activity can only
-schedule child activities.
-completeIf you want something to be triggered multiple times, once per bookmark, I'd advise making it into a child activity (or activity delegate) instead. Then you can schedule it from your bookmark callback.
TimThank You Tim
I would like to see how to create child activity (or activity delegate for this)
-
Wednesday, March 28, 2012 10:44 PMModeratorThe NativeActivity documentation page has a short sample showing how to schedule a child activity. A child activity need be nothing special, just another activity.
Tim

