Deploying to Message Broker
Having built an assembly file from the C# code, it is possible to drag and drop the assembly file from a Windows Explorer window directly onto a .NETCompute node in a message flow in order to associate the node with the code. This technique results in a hard-coded absolute location for the assembly, and it is useful when developing, testing, and hot swapping the .NET code that the Broker is executing. However, for production situations, a better approach is to define a Message Broker Configurable Service that specifies a .NETCompute node to locate the assembly file. This method is much more dynamic and better suited when moving a deployment between environments during development, test, and production. The diagram below shows that the same message flow can be used in multiple environments, with the configurable service in each environment defining the location of the assembly file, which may be at a different location on the file system for each environment.
Use this approach and define a configurable service using the following steps:
- Using a Windows Explorer window, make a copy of the assembly and debug files, which are named
Copy both files from the directory: C:\student\DOTNET\lab_sample\visual studio 2010\Projects\ SampleDotNetProject\SampleDotNetProject\bin\Debug To the directory: C:\student\DOTNET\lab_sample\AssemblyFile
- Define the required configurable service for the message flow using Message Broker Explorer, which is a graphical user interface for administering your brokers based on the Eclipse platform.
Message Broker Explorer is an extension to WebSphere MQ Explorer.
Open Message Broker Explorer: Select Start => IBM WebSphere Message Broker 220.127.116.11 => Message Broker Explorer. Right-click the Configurable Services folder for the runtime broker you are using and select New => Configurable Service.
- Set the following parameters:
- Return to the WebSphere Message Broker Toolkit and navigate to the properties of the .NETCompute node named Filter. Switch to the Advanced tab
and set the AppDomain name to be
- Repeat the last step for the other two .NETCompute nodes in the message flow, named Modify and Create. Each of these nodes uses a class defined inside the same assembly, and each of the nodes will locate the assembly at runtime using the configurable service you defined above.
- The rest of the tutorial assumes that you have created a queue manager named MB8QMGR and a runtime broker named MB8BROKER, which are known as the Default Configuration. For more information, see Creating the Default Configuration in the Message Broker information center.
- The message flow requires the creation of two MQ queues, DOTNET.IN and DOTNET.OUT. Return to Message Broker Explorer and right-click the Queues folder underneath your Queue Manager
(in the screenshot below the queue manager is named MB8QMGR) and choose New => Local Queue:
- Specify the Name
DOTNET.INand click Finish:
- Repeat the last two steps to create a queue named
- Return to Message Broker Toolkit and open the BAR file named DotNet.bar, located inside DotNetApplication. Click Rebuild and Save:
- Deploy the BAR file DotNet.bar by dragging and dropping it onto the execution group:
The next section of the tutorial shows you how to test the scenario.