1. Problem
You have deployed a BAM
workbook and the associated BizTalk artifacts. You need to map the
BizTalk artifacts to the deployed BAM workbook milestones, data items,
and key performance indicators. Additionally, you need to save the
mapped profile for deployment to other environments.
2. Solution
The example reviewed as part of
this recipe outlines how to use BizTalk's Tracking Profile Editor to
map BizTalk artifacts to an Excel BAM workbook. The following sections
outline the category of steps required for creating a tracking profile,
mapping BizTalk artifacts to the deployed workbook activities within the
Tracking Profile Editor, and finally applying the tracking profile to
the deployed BizTalk artifacts. The three main categories of steps are
as follows:
Select the activity and artifacts.
Map events and data items.
Save and apply the tracking profile.
2.1. Select the Activity and Artifacts
To select the activity and artifacts, follow these specific steps:
From the Start menu, open the Tracking Profile Editor by selecting Start => All Programs => Microsoft BizTalk Server 2010 => Tracking Profile Editor. You will see an application screen that looks similar to Figure 1.
NOTE
This solution assumes you have deployed a BAM workbook and BizTalk artifacts.
Click the Click Here to Import BAM Activity Definition link to load the deployed BAM workbook and associated activity:
The
BAM Import Activity dialog box will ask you to choose the activity to
use in the Tracking Profile Editor.
Leave
the Retrieve the Current Tracking Settings for This Activity Definition
box unchecked, and click the OK button to select the activity.
NOTE
If you have already
applied a tracking profile to the selected activity, you can retrieve
the results by selecting the Retrieve the Current Tracking Settings for
This Activity Definition box.
Click
the Click Here to Select an Event Source to load the BizTalk artifacts
that will be used during the mapping activity. Identify the assembly
that contains the orchestration to map, and identify the specific
orchestration that contains data for mapping.
NOTE
In this example, a
basic orchestration has been created that performs a message receive
and send and that implements a catch block for any exceptions. In this
example, the name of the assembly is BizTalk Server BAM Test, and the
name of the orchestration is BizTalk_Orchestration_BAM.
On
the Select Event Source Parent Assembly page, locate the assembly that
contains the orchestration you would like to map to the activity. Click
the Next button to continue and to select the orchestration to map.
On
the Select Orchestration page, select the name of the orchestration you
would like to map to the activity. Click the OK button to complete the
Event Source Wizard. Figure 2 displays the example with a sample orchestration.
2.2. Map Events and Data Items
To map events and data items, follow these steps:
Drag the orchestration shapes to the Activity nodes listed in Table 1.
Table 1. Sample Orchestration Step Mapping
Activity Node | Orchestration Step | Description |
---|
Begin | Drag the Receive_Msg shape to the Begin activity node. | Captures the successful receipt of a message, which indicates that the process began successfully |
EndSuccess | Drag the Send_Msg shape to the End activity node. | Captures the successful sending of a message, which indicates that the process completed successfully |
EndException | Drag the LogException shape to the EndException activity node. | Logs an exception occurred in the process |
Right-click the Receive_Msg shape, and choose Message Payload Schema.
Expand the <Schema> folder icon, and navigate to the data items that are to be reported in BAM.
Drag each reportable data item to the correct Activity node. Table 2 outlines the mapping of sample orchestrations to the deployed BAM activities.
Table 2. Sample Orchestration Data Item Mapping
Activity Node | Orchestration Step | Description |
---|
Transaction ID | Drag the Customer.MessageID node to the Transaction ID node. | MessageID is the unique identifier for the message received. |
Transaction Type | Drag the Customer.TransactionType node to the TransactionType activity node. | TransactionType is the transaction identifier indicating the type of message received. |
Figure 3 demonstrates the completed mapping between the sample orchestration and activity.
2.3. Save and Apply the Tracking Profile
To save and apply the tracking profile, follow these steps:
From
the Tools menu, select Apply Tracking Profile. Applying the tracking
profile immediately sets the mapping to start recording data the next
time the orchestration or process executes.
If
you plan on deploying the tracking profile in other environments or
would like to save a copy of the profile, then choose File => Save As.
3. How It Works
BAM is a powerful tool and architecture for monitoring
predetermined milestones and business data. Implementing BAM requires
identifying the milestones and business data to report and then mapping
those data points to the physical BizTalk solution artifacts. You can
map milestones and business data to physical solution artifacts via the
Tracking Profile Editor or via the BAM APIs and custom code.
This recipe outlined
how to use the BizTalk Tracking Profile Editor to map between a deployed
BAM workbook and physical BizTalk solution artifacts. This example
outlined a simple scenario involving the mapping of a deployed activity
to a single orchestration and data points contained within the message
processed by the single orchestration. However, the Tracking Profile
Editor can map multiple BizTalk artifacts to a single BizTalk activity
or multiple activities. When using the Tracking Profile Editor, keep in
mind the three categories of steps that were completed in this recipe,
as outlined in the following sections.
3.1. Select the Activity and Artifacts
Before mapping an
activity to a BizTalk solution artifact, you must choose the activity
and the BizTalk artifact(s) that will be mapped. When you open the
Tracking Profile Editor, you first select the activity from the list of
deployed activities that will be receiving data. Once the activity
loads, it will display each of the defined milestones and data items
that were previously defined in the activity. The list of the milestones
and data items is referred to as the activity tree.
An activity tree lists the stages and business data items tracked in
the deployed activity. When you load an activity in the Tracking Profile
Editor, the stages identified in the activity and the business data
items appear in the tree.
The basic premise of the
Tracking Profile Editor is the ability to map from the deployed activity
(which is a conceptual view of a business process) to the physical
BizTalk solution. When loading an activity, in the Tracking Profile
Editor the activity tree will list all the items created in the deployed
activity.
NOTE
In addition to the
list of activity items displayed in the activity tree, you can create
four additional items. Please review the "Considerations" section of
this recipe for more information about the additional items you can
create.
After selecting the
activity, the next step is to select the BizTalk artifacts that will be
contributing data to the items listed in the activity tree.
3.2. Map Events and Data Items
The next category of steps
involves the physical mapping between the BizTalk artifacts and the
activity items listed in the activity tree. You map between a BizTalk
artifact and an activity item by dragging the BizTalk artifact to the
activity item. After dragging the BizTalk artifact to the activity item
tree, the artifact will be listed in the activity tree.
3.3. Save and Apply the Tracking Profile
The final category of steps
applies the tracking profile to the deployed BizTalk artifacts and
allows you to save the tracking profile for deploying in other
environments or making adjustments later.
3.3.1. Activity Tree Items
The activity tree typically
lists the milestones and data items defined in an activity. However, you
can also create four other types of items in the activity tree to
further enrich your BAM solution. Table 3
outlines the items that are included as part of the deployed activity
as well as the additional possible items available in the Tracking
Profile Editor to help you map activity items to the solution artifacts.
Table 3. Activity Tree Items
Tracking Profile | Description | NotesEditor Item Icon |
---|
Stage | Automatically
created in the activity tree when defining a milestone within an
activity. The stages are listed when an activity is loaded. | Orchestration
steps are mapped to this shape. Some orchestration steps cannot be
mapped to this shape including Termination shapes and any steps included
within a Loop shape. |
Data Item | Automatically
created in the activity tree when defining a data item within an
activity. The data items are listed when an activity is loaded | You
can specify data items from messages in orchestrations or pipelines.
Additionally, you can specify context property information for those
messages. |
Activity ID | Uniquely identifies the instance of an activity that has executed and is automatically included within the activity tree. | This
value can be user generated and identified from a message. However, the
field must be unique, because it is a key in a SQL Server table. If no
value is mapped in the Tracking Profile Editor, BAM will automatically
generate this value. |
Continuation | Inserts a new continuation folder within the activity tree. | Used
in conjunction with ContinuationID to allow multiple components to
populate the same activity. For example, if Orchestration A depends on
Orchestration B and both contribute data to the same activity, then a
continuation folder would be created and mapped to a data item in
Orchestration A that is carried over to Orchestration B. |
ContinuationID | Inserts a new continuation ID folder within the activity tree. | ContinuationID is mapped to the data item in Orchestration B that was passed from Orchestration A. |
Relationship | Relationship folders are used to imply a relationship between one or more activities. | Relationships
are especially useful in relating two activities for a single
orchestration. For example, if you have an orchestration with a Loop
shape, the orchestration and the Loop shape must be represented by
separate activities. Via the relationship folder, you can create a
relationship between the two activities. |
Document Reference URL | Allows the linking of a document related to this instance of the activity. | The file name can be mapped from either a schema value or a context property on the message. |
3.3.2. Activity Continuation
Activity continuation
is the process of taking multiple BizTalk physical artifacts and
combining data from those artifacts into a single activity. Combining
data is a useful option when a business process spans multiple BizTalk
solution artifacts. Think of the process of creating an activity as
defining a database table structure with multiple columns representing
the containers for the business data and milestones. When a process
executes, it creates a new row in the activity database table recording
the data as mapped in the Tracking Profile Editor. Multiple BizTalk
artifacts reporting data to the same activity results in multiple rows
created in the activity database table. For those artifacts to
contribute to a single row in the activity, you need a continuation
between the artifacts indicating their relationship.
A common business scenario
where activity continuation is useful is the scenario of a life cycle of
a purchase order. One company sends a purchase order to another company
to purchase goods. The entity shipping the goods will typically send a
shipment notice after receiving the purchase order. Additionally, the
entity shipping the goods will usually send an invoice for payment of
the shipped goods. Managing the sending a purchase order and the receipt
of a shipment notice and invoice typically involves many BizTalk
artifacts. However, it may be useful to have an end-to-end view of the
purchase order life cycle (once issued to the receipt of an invoice)
versus each artifact reporting independently. With activity
continuation, all the artifacts involved in the life cycle of a purchase
order can report information to a single activity, allowing for an
end-to-end view of the purchase order life cycle.
Consider the following
example: Orchestration A processes a message and transmits that message
to Orchestration B for processing. When Orchestration B is finished, it
sends a response message back to Orchestration A. When Orchestration A
receives the response from Orchestration B, it completes processing. Figure 4 demonstrates the sample relationship between Orchestration A and B.
Both Orchestration A
and Orchestration B can be mapped to the sample activity. However, when
the orchestrations execute, two data rows will be created in the
activity table to record the information from the orchestrations (one
for Orchestration A and one for Orchestration B). If both orchestrations
need to contribute data to the same row in the activity, you must
create a continuation in the activity tree to indicate the continuation
of activity between Orchestration A and Orchestration B.
The following items are required to create an activity continuation between two orchestrations:
A data item that
relates the two orchestrations (or other BizTalk artifacts) and that can
be an attribute in a message shared between the two orchestrations
A continuation folder that specifies the data item in a parent orchestration that relates the two orchestrations
A continuation ID folder identifies the data item in the child orchestration that relates the two orchestrations
NOTE
The name of continuation
folder and the name of continuation ID folder must be identical in the
activity tree. For example, if you create a continuation folder with the
name of Continuation, you must create a continuation ID folder with the name of Continuation. You will receive an exception message if the continuation folder and continuation ID folder do not share the same name.
In the Orchestration A and
Orchestration B example, the message ID in Orchestration A from the Send
shape is mapped to the continuation folder. The same message ID in the
Orchestration B Receive shape is mapped to the continuation ID folder.
The message ID is the data item that links the two orchestrations and is
also the data item in the continuation and continuation ID folders. The
BAM end-to-end SDK sample included with the standard BizTalk
installation provides a sample implementation of a continuation.
3.3.3. Activity Relationships
Activity relationships
are different from activity continuations in that they allow implicit
linking between multiple activities. Consider the Orchestration A and
Orchestration B example. If both orchestrations represented different
business processes, then it may not make sense to have them report to
the same activity. If they report to different activities, it may be
useful to represent that the activities have a relationship but are
disparate. A real-world example of an activity relationship may be how a
single purchase order represents multiple shipments. Each activity
(purchase order and shipment) is a different activity but is related to
the others.
Activity relationships
are also necessary when needing to report on BizTalk orchestrations that
contain the Loop shape. You can define the parent orchestration as one
activity and the looping activity as a separate activity and still
accurately report on the activity of the entire process.
When creating activity relationships, you must adhere to the following guidelines:
Related activities should belong to the same BAM view.
A
relationship item must be created in each activity in the Tracking
Profile Editor and must be given the appropriate name of the related
activity.
Consider that Activity A
reports on the activity in Orchestration A and Activity B reports on the
activity in Orchestration B; you would create the relationships
activity items listed in Table 4.
Table 4. Example Relationship
Orchestration Name | Activity Name | Relationship Item Name |
---|
Orchestration A | Activity A | Activity B |
Orchestration B | Activity B | Activity A |
After specifying the
activity items in each activity, the data item that represents the
relationship between the activities must be mapped to each activity
item. After creating the relationship item in Activity A, a data item
(for example, the message ID) that is shared between the activities
would need to be mapped to Activity A. The same data item (that is, the
message ID) is then mapped to the ActivityID item of Activity B. Mapping
the data item to the ActivityID creates the relationship between the
first and second activity.