Setting message flow accounting and statistics accounting origin

Before you start:

Accounting and statistics data is associated with an accounting origin.

When you request accounting origin support for collecting message flow accounting and statistics data on the mqsichangeflowstats command, you must also configure your message flows to provide the correct identification values that indicate what the data is associated with. You can set a different value for every message flow for which data collection is active, or the same value for a group of message flows (for example, those in a single execution group, or associated with a particular client, department, or application suite).

The accounting origin setting is not used until you deploy the message flow or flows to the brokers on which they are to run. You can activate data collection, or modify it to request accounting origin support, before or after you deploy the message flow. You do not have to stop collecting data when you deploy a message flow that changes accounting origin.

To configure a message flow to specify a particular accounting origin:

  1. Switch to the Broker Application Development perspective.
  2. Open the message flow that you want to work with.
  3. Click Selection above the palette of nodes.
  4. Right-click a Compute, Database, or Filter node in the editor view, and click Open ESQL. The associated ESQL file is opened in the editor view, and your cursor is positioned at the start of the correct module. You can include the required ESQL in any of these nodes, so decide which node in each message flow is the most appropriate for this action.

    If you want to take advantage of the accounting origin support, you must include one of these nodes in each message flow for which you want a specific origin set. If you have not configured one of these three nodes in the message flow, you must add one at a suitable point (for example, immediately following the input node) and connect it to other nodes in the flow.

  5. Update the ESQL in the node's module to set an accounting origin. The broker uses the origin identifier that is set in the Environment tree. You must set a value in the field with correlation name Environment.Broker.Accounting.Origin. This field is not created automatically in the Environment tree when the message is first received in the broker. It is created only when you set it in an ESQL module associated with a node in the message flow.

    If you do not set a value in the message flow, the default value Anonymous is used for all output. If you set a value in more than one place in the message flow, the value that you set immediately before the message flow terminates is used in the output data.

    The code that you need to add is of the form:

    SET Environment.Broker.Accounting.Origin = "value";

    You can set the identifier to a fixed value if you choose (as shown above), or you can determine its value based on a dynamic value that is known only at runtime. The value must be character data, and can be a maximum of 32 bytes. For example, you might set its value to the contents of a particular field in the message that is being processed (if you are coding ESQL for a Compute node, you must use correlation name InputBody in place of Body in the following example):

    IF Body.DepartmentName <> NULL THEN
       SET Environment.Broker.Accounting.Origin = Body.DepartmentName;
    END IF;
  6. Save the ESQL module, and check that you have not introduced any errors.
  7. Save the message flow, and check again for errors.
You are now ready to deploy the updated message flow. Accounting and statistics data records that are collected after the message flow has been deployed will include the origin identifier that you have set.
Related concepts
Message flows overview
Message flow accounting and statistics data
Related tasks
Developing message flows
Deploying
Modifying message flow accounting and statistics data collection parameters
Writing ESQL
Related reference
mqsichangeflowstats command
Compute node
Database node
Filter node
Message flow accounting and statistics data