# MTRemeter

## Program ID

MetraPipeline.MTReMeterPlugin

## Sections

This topic is broken down into the following sections:

- Description

- Required Input Properties

- Required Output Properties

- Additional Configuration Tags

- Configuration Examples

- Failure Cases

- Remarks

## Description

The MTRemeter plug-in meters a session to a pipeline using the MetraTech Metering SDK.

The MTRemeter plug-in initializes the Metering SDK from the information in the configuration file. The MTRemeter plug-in then reads the <ServiceProperties> section and determines what properties in the current session map to the new session.

The <ServiceProperties> section is a list of properties in sets of three. Each set is composed of the following information:

- RemeterServiceTag

- SessionProp

- Type

The following is an example of a property set:

<ReMeterServiceTag>_AccountID</ReMeterServiceTag>
<SessionProp>_AccountID</SessionProp>
<Type>int32</Type>
<ReMeterServiceTag>transactionid</ReMeterServiceTag>
<SessionProp>ConferenceID</SessionProp>
<Type>string</Type>
<ReMeterServiceTag>_Amount</ReMeterServiceTag>
<SessionProp>_Amount</SessionProp>
<Type>decimal</Type>

If any required properties for the service definition are missing from the <ServiceProperties> section, metering will fail. The user is not required to meter optional properties. If the service definition is available on the local machine, the plug-in will validate that the session properties match those required by the service definitions.

If output values are required, the RequestFeedback property must be set to TRUE and a FeedBackProperties set must be specified. Output values are useful if you need to meter to a pipeline stage synchronously and access computed values rather than store the information in a database. The remeter plug-in sets the output properties from the MSIX session in the current pipeline session. The MetraTech platform uses synchronous metering to perform account creation.

Note: | The system propagates the original session's context to generated sessions.

Note: | This plugin can be configured to meter transactionally (see the transactional tag below).

Back to Top of Page

## Required Input Properties

Tag name | Value type | Description
RemeterProcessSession | long | A Boolean value that indicates if the plug-in should remeter to another pipeline stage. Useful if you want to not execute the plug-in.
ReMeterServiceTag | string | The Remeter service tag specifies what property in the current session will be mapped to SessionProp. If this tag is in the FeedBackProperties set, it specifies the name of the output property in the session. See the configuration example for more details.

Back to Top of Page

## Required Output Properties

None.

## Additional Configuration Tags

Tag name | Value type | Description
AlternatePort | integer | Specifies an alternate port number. If AlternatePort is 0, the default value is used (80 for non-secure, 443 for secure). The password required for the specified username. Ignored if serverAccessEntry is specified.
Listener | string | The address of the host where the session will be metered. Can be an IP address or host name. Ignored if ServerAccessEntry is specified.
MeterUserName | string | The username required for metering. Ignored if ServerAccessEntry is specified.
MeterUserPassword | string | The password required for the specified username. Ignored if serverAccessEntry is specified.
RequestFeedback | boolean or long | This value must be set if output properties are required. For backwards compatibility, this value can also be a long property where 0 = false and 1 = true.
Secure | boolean | Specifies whether to use SSL (Secure Sockets Layer) when Metering to the listener. The password required for the specified username. Ignored if serverAccessEntry is specified.
ServerAccessEntry | string | The name of an entry in config\serveraccess\servers.xml. Each entry contains the standard set of information required to configure the SDK. If this value is blank, the user must specify the properties listed below. It is highly recommended that the user use server access. The properties are listed below.
ServiceName | string | The name of the MetraTech service (required by the metratech SDK).
Transactional | BOOLEAN | If true, the ID of current transaction will be remetered. This causes the remetered session to participate in the current transaction. Both sessions will be committed or rolled back as a unit.
The following properties are in the ServiceProperties set:
SessionProp | string | SessionProp occurs for as many session properties are in ServiceName. Each SessionProp must be in conjunction with a ReMeterServiceTag and a Type.
Type | string | The type of value stored in the ReMeterServiceTag property as well as SessionProp. Possible types: "string", "int32", "double", and "timestamp", and "enum". Enum properties require two additional attributes: enumspace and enumtype.
The following properties are in the FeedBackProperties set:
SessionProp | string | The FeedBackProperties set is used if the RequestFeedback property is set to TRUE. SesionProp is the name of the property that stores the value of ReMeterServiceTag. Each SessionProp must be in conjunction with a ReMeterServiceTag and a Type.
Type | string | The type of value stored in the ReMeterServiceTag property as well as SessionProp. Possible types: "string", "int32", "double", and "timestamp", "decimal", and "enum". Enum properties require two additional attributes: enumspace enumtype.

Back to Top of Page

## Configuration Examples

This sample meters to the account creation pipeline and requires a number of output properties. Notice that this example uses the "AccountPipeline" server access entry. The following is a sample "AccountPipeline" entry in servers.xml:

<server>
<servertype>AccountPipeline</servertype>
<servername>127.0.0.1</servername>
<numretries ptype="INTEGER">5</numretries>
<timeout ptype="INTEGER">30</timeout>
<priority ptype="INTEGER">0</priority>
<secure ptype="INTEGER">0</secure>
<portnumber ptype="INTEGER">80</portnumber>
<username>mtsystem</username>
<password>mtsystem</password>
<dtcenabled ptype="INTEGER">1</dtcenabled>
</server>

<configdata>
<ServerAccessEntry>AccountPipeline</ServerAccessEntry>
<Listener>127.0.0.1</Listener>
<Secure ptype="BOOLEAN">FALSE</Secure>
<AlternatePort ptype="INTEGER">0</AlternatePort>
<MeterUserName></MeterUserName>
<MeterUserPassword></MeterUserPassword>

<RequestFeedback ptype="BOOLEAN">TRUE</RequestFeedback>
<ServiceName>metratech.com/accountcreation</ServiceName>
<RemeterProcessSession>RemeterProcessSession</RemeterProcessSession>

<ServiceProperties>
<ReMeterServiceTag>_transactioncookie</ReMeterServiceTag>
<SessionProp>accountserver_cookie</SessionProp>
<Type>string</Type>

<ReMeterServiceTag>ActionType</ReMeterServiceTag>
<SessionProp>ActionType</SessionProp>
<Type enumspace="metratech.com/accountcreation"
enumtype="ActionType">enum
</Type>

<ReMeterServiceTag>city</ReMeterServiceTag>
<SessionProp>city</SessionProp>
<Type>string</Type>

<ReMeterServiceTag>state</ReMeterServiceTag>
<SessionProp>state</SessionProp>
<Type>string</Type>

<ReMeterServiceTag>zip</ReMeterServiceTag>
<SessionProp>zip</SessionProp>
<Type>string</Type>

<ReMeterServiceTag>username</ReMeterServiceTag>
<SessionProp>username</SessionProp>
<Type>string</Type>

<ReMeterServiceTag>password_</ReMeterServiceTag>
<SessionProp>password_</SessionProp>
<Type>string</Type>

<ReMeterServiceTag>name_space</ReMeterServiceTag>
<SessionProp>name_space</SessionProp>
<Type>string</Type>

<ReMeterServiceTag>Language</ReMeterServiceTag>
<SessionProp>Language</SessionProp>
<Type enumspace="Global" enumtype="LanguageCode">enum</Type>

<ReMeterServiceTag>dayofmonth</ReMeterServiceTag>
<SessionProp>dayofmonth</SessionProp>
<Type>int32</Type>

<ReMeterServiceTag>AccountType</ReMeterServiceTag>
<SessionProp>AccountType</SessionProp>
<Type enumspace="metratech.com/accountcreation"
enumtype="AccountType">enum
</Type>

<ReMeterServiceTag>taxexempt</ReMeterServiceTag>
<SessionProp>taxexempt</SessionProp>
<Type>bool</Type>

<ReMeterServiceTag>tariffID</ReMeterServiceTag>
<SessionProp>tariffID</SessionProp>
<Type enumspace="metratech.com/tariffs"
enumtype="tariffID">enum
</Type>

<ReMeterServiceTag>firstname</ReMeterServiceTag>
<SessionProp>firstname</SessionProp>
<Type>string</Type>

<ReMeterServiceTag>lastname</ReMeterServiceTag>
<SessionProp>lastname</SessionProp>
<Type>string</Type>

<ReMeterServiceTag>email</ReMeterServiceTag>
<SessionProp>email</SessionProp>
<Type>string</Type>

<ReMeterServiceTag>phonenumber</ReMeterServiceTag>
<SessionProp>phonenumber</SessionProp>
<Type>string</Type>

<ReMeterServiceTag>_Accountid</ReMeterServiceTag>
<SessionProp>accountID_default</SessionProp>
<Type>int32</Type>

<ReMeterServiceTag>timezoneID</ReMeterServiceTag>
<SessionProp>timezoneID</SessionProp>
<Type enumspace="Global" enumtype="TimeZoneID">enum</Type>

<ReMeterServiceTag>timezoneoffset</ReMeterServiceTag>
<SessionProp>timezoneoffset</SessionProp>
<Type>double</Type>

<ReMeterServiceTag>company</ReMeterServiceTag>
<SessionProp>company</SessionProp>
<Type>string</Type>

<ReMeterServiceTag>address1</ReMeterServiceTag>
<SessionProp>address1</SessionProp>
<Type>string</Type>

<ReMeterServiceTag>address2</ReMeterServiceTag>
<SessionProp>address2</SessionProp>
<Type>string</Type>

<ReMeterServiceTag>address3</ReMeterServiceTag>
<SessionProp>address3</SessionProp>
<Type>string</Type>

<ReMeterServiceTag>country</ReMeterServiceTag>
<SessionProp>country</SessionProp>
<Type enumspace="Global" enumtype="CountryName">enum</Type>

<ReMeterServiceTag>facsimiletelephonenumber</ReMeterServiceTag>
<SessionProp>facsimiletelephonenumber</SessionProp>
<Type>string</Type>

<ReMeterServiceTag>middleinitial</ReMeterServiceTag>
<SessionProp>middleinitial</SessionProp>
<Type>string</Type>

<ReMeterServiceTag>usagecycletype</ReMeterServiceTag>
<SessionProp>usagecycletype</SessionProp>
<Type enumspace="metratech.com/BillingCycle"
enumtype="UsageCycleType">enum
</Type>

<ReMeterServiceTag>PaymentMethod</ReMeterServiceTag>
<SessionProp>PaymentMethod</SessionProp>
<Type enumspace="metratech.com/accountcreation"
enumtype="PaymentMethod">enum
</Type>

<ReMeterServiceTag>operation</ReMeterServiceTag>
<SessionProp>operation</SessionProp>
<Type enumspace="metratech.com" enumtype="operation">enum</Type>

<ReMeterServiceTag>accountstartdate</ReMeterServiceTag>
<SessionProp>accountstartdate</SessionProp>
<Type>timestamp</Type>

<ReMeterServiceTag>accountenddate</ReMeterServiceTag>
<SessionProp>accountenddate</SessionProp>
<Type>timestamp</Type>

<ReMeterServiceTag>AccountStatus</ReMeterServiceTag>
<SessionProp>AccountStatus</SessionProp>
<Type enumspace="metratech.com/accountcreation"
enumtype="AccountStatus">enum
</Type>

<ReMeterServiceTag>StatusReason</ReMeterServiceTag>
<SessionProp>StatusReason</SessionProp>
<Type enumspace="metratech.com/accountcreation"
enumtype="StatusReason">enum
</Type>

<ReMeterServiceTag>StatusReasonOther</ReMeterServiceTag>
<SessionProp>StatusReasonOther</SessionProp>
<Type>string</Type>

<ReMeterServiceTag>SecurityQuestion</ReMeterServiceTag>
<SessionProp>SecurityQuestion</SessionProp>
<Type enumspace="metratech.com/accountcreation"
enumtype="SecurityQuestion">enum
</Type>

<ReMeterServiceTag>SecurityAnswer</ReMeterServiceTag>
<SessionProp>SecurityAnswer</SessionProp>
<Type>string</Type>

<ReMeterServiceTag>InvoiceMethod</ReMeterServiceTag>
<SessionProp>InvoiceMethod</SessionProp>
<Type enumspace="metratech.com/accountcreation"
enumtype="InvoiceMethod">enum
</Type>

<ReMeterServiceTag>dayofweek</ReMeterServiceTag>
<SessionProp>dayofweek</SessionProp>
<Type enumspace="Global" enumtype="DayOfTheWeek">enum</Type>

<ReMeterServiceTag>firstdayofmonth</ReMeterServiceTag>
<SessionProp>firstdayofmonth</SessionProp>
<Type>int32</Type>

<ReMeterServiceTag>seconddayofmonth</ReMeterServiceTag>
<SessionProp>seconddayofmonth</SessionProp>
<Type>int32</Type>

<ReMeterServiceTag>startmonth</ReMeterServiceTag>
<SessionProp>startmonth</SessionProp>
<Type enumspace="Global" enumtype="MonthOfTheYear">enum</Type>

<ReMeterServiceTag>startday</ReMeterServiceTag>
<SessionProp>startday</SessionProp>
<Type>int32</Type>

<ReMeterServiceTag>startyear</ReMeterServiceTag>
<SessionProp>startyear</SessionProp>
<Type>int32</Type>

</ServiceProperties>

<FeedBackProperties>

<ReMeterServiceTag>_AccountID</ReMeterServiceTag>
<SessionProp>_AccountID</SessionProp>
<Type>int32</Type>

<ReMeterServiceTag>ActionType</ReMeterServiceTag>
<SessionProp>NewActionType</SessionProp>
<Type enumspace="metratech.com/accountcreation"
enumtype="ActionType">enum
</Type>

<ReMeterServiceTag>_Amount</ReMeterServiceTag>
<SessionProp>_Amount</SessionProp>
<Type>decimal</Type>

</FeedBackProperties>

</configdata>

The following is a case where the Transactional tag is used:

<configdata>

<ServerAccessEntry>DTCGetWhereAbouts</ServerAccessEntry>

<Listener></Listener>

<Secure ptype="BOOLEAN">FALSE</Secure>

<AlternatePort ptype="INTEGER">0</AlternatePort>

<MeterUserName></MeterUserName>

<MeterUserPassword></MeterUserPassword>

<RequestFeedback ptype="BOOLEAN">TRUE</RequestFeedback>

<Transactional ptype="BOOLEAN">TRUE</Transactional>

<ServiceName>metratech.com/dtctest</ServiceName>

<RemeterProcessSession>RemeterProcessSession</RemeterProcessSession>

<ServiceProperties>

<ReMeterServiceTag>Units</ReMeterServiceTag>

<SessionProp>Units</SessionProp>

<Type>double</Type>

<ReMeterServiceTag>Description</ReMeterServiceTag>

<SessionProp>Description</SessionProp>

<Type>string</Type>

<ReMeterServiceTag>AccountName</ReMeterServiceTag>

<SessionProp>AccountName</SessionProp>

<Type>string</Type>

<ReMeterServiceTag>Time</ReMeterServiceTag>

<SessionProp>Time</SessionProp>

<Type>timestamp</Type>

</ServiceProperties>

</configdata>

Back to Top of Page

## Failure Cases

- Remetering will fail if the session is rejected by the listener. This can happen if the session is missing properties required by the service definition or the listener can not find the service definition.

- Remetering will also fail if metering synchronously and the remote pipeline encounters an error.

- The plug-in will fail if one of the values in RemeterserviceTag is missing from the current session.

- The plug-in will fail if one of the output properties specified in the FeedBackProperties set is missing from the metered session. You can not use the Remeter plug-in with output properties if you can not guarantee that the output property will be available.

- The plug-in will fail with a time out error if RequestFeedback is True and the listener is not available. This is also true if the stage is not running.

## Remarks

The default time-out for synchronous metering is 30 seconds. This value can be changed using the MetraTech Platform Manager under Active Configuration -> Metering Server -> Configuration -> feedback_timeout. Note that this timeout value must be changed if there is the possibility that the remote pipeline can block for more than 30 seconds.

Back to Top of Page