Routing a message using a .NETCompute node

Route a message by using the .NETCompute node as a filter node.

Before you begin

Add a .NETCompute node to your message flow.

About this task

By default, the output message assembly is propagated to the Out terminal after the evaluate method in the .NET code has been processed. However, the .NETCompute node supports dynamic terminals. You can create extra terminals, and use the .NETCompute as a filter node by propagating a message to the appropriate terminal, based on the message content.

The following snippet of C# code shows how you might filter a message, depending on the content of an element in the message:

            #region UserCode
            // Add user code in this region to filter the message
            
            if (root[NBParsers.XMLNSC.ParserName].LastChild.Name.Equals("LoyaltyProgram"))
            {
                outTerminal.Propagate(assembly);
            }

            if (root[NBParsers.XMLNSC.ParserName].LastChild.Name.Equals("SaleEnvelope"))
            {
                altTerminal.Propagate(assembly);
            }
            else
            {
                failureTerminal.Propagate(assembly);
            }
            #endregion UserCode

For information about the .NET classes and methods that are supported in IBM® App Connect Enterprise, see the .NET API documentation.