Preparation and deployment to Message Broker
Having built an assembly file from the C# code, you can drag and drop the assembly file from a Windows Explorer window directly onto the message flow canvas in order to create a .NETCompute node that is associated with the assembly file's code. This technique results in a hard-coded, absolute location for the assembly (set to the location that you dragged from), and is intended as a quick method when developing, testing, and hot-swapping the .NET code that the Broker is executing. For production situations, a more typical approach is to define a Message Broker Configurable Service that specifies to a .NETCompute node where to locate the assembly file. Here is the drag and drop technique for the configuration of the current scenario:
- To prepare for the drag and drop, return to the WebSphere Message Broker Toolkit, where the message flow
MyFlow.msgflowthat you created earlier should still be open. Open a Windows Explorer window in front of the Toolkit and navigate to the location where you built the assembly file in the previous section. If you have followed the default naming so far, the location will be:
C:\student\DOTNET\lab_msexcel\visual studio 2010\Projects\MSExcelDotNetProject\ MSExcelDotNetProject\bin\Debug\MSExcelDotNetProject.dll
Drag and drop the assembly on top of the .NETCompute node in the flow, as shown by the red arrow:
- Wire up the Out terminal of the FileInput node to the In terminal of the .NETCompute node. Also wire the Out terminal of the .NETCompute node to the In terminal of the FileOutput node.
The message flow should now look like this:
- Inspect the properties of the .NETCompute node and you should see that the Assembly name property has now been configured, as shown below.
Save the message flow by pressing Ctrl-S:
- Select the FileInput node and inspect its properties. On the Basic properties panel, set the Input directory to be
C:\student\DOTNET\lab_msexcel\inputand set the File name or pattern to be
*.xml. These properties mean that the message flow will start whenever a file with the extension .xml is found in the above directory. Here are the Basic node properties:
Switch to the Input Message Parsing properties panel and set the Message Domain property (you can use the drop-down) to the value
XMLNSC : For XML messages (namespace aware, validation, low memory use). This setting means that the message flow will expect inbound files to contain well-formed XML, and will construct the logical message tree using the broker's XMLNSC parser. If you wished, you could specify a particular message model (XML schema) to which inbound data should conform, but for the purposes of this tutorial, just specify the XMLNSC message domain so that any XML document can be used to test the scenario. Here are the Input Message Parsing node properties:
- Select the FileOutput node and inspect its properties. On the Basic properties panel, set the Directory to be
C:\student\DOTNET\lab_msexcel\outputand set the File name or pattern to be
*.xml. The output file name used by the node will be the same as the input file name, because the .NETCompute node copies the LocalEnvironment tree, which provides a dynamic override for the file name. Here are the Basic node properties:
- Save the message flow.
- Before deploying the message flow, using a Windows Explorer window, create the file directories that it uses to read input files and write output files:
The image below shows the
C:\student\DOTNET\lab_msexceldirectory after the two subdirectories have been created:
- This tutorial assumes that you have already set up a runtime broker using the default configuration, which provides a message broker named
MB8BROKER. For more information on the default configuration, see Creating the Default Configuration in the Message Broker information center.
- In order to deploy the application containing the message flow that you created, simply drag and drop it onto a runtime execution group, such as the default configuration shown below.
The red arrow shows the drag and drop movement:
The next section of the tutorial shows you how to test the scenario.