Transaction message example for the sending program

This section describes the data in the message that your sending program must produce when you use a queue data source connector for transaction data. It also provides a code sample for creating a transaction message in the required format.

Information required for the transaction message

When you use a queue connector for transaction data, the sending program must provide the following information in the data sent to the queue server.

Table 1. Required information for transaction data
Name Value
AUDHASH Hash for the audienceId generated using a standard hash function. The function must generate a positive value.

Used in the header of a JMS message.

deploymentConfigurationId You can obtain the ID of the deployment configuration on the Deployment tab of the workspace. Select the deployment configuration and select the History tab in the panel that opens. Look under the Message column for the configuration ID.

Used in the header and the body of a JMS message.

inputVersion The input version number entered on the Properties tab of the deployment configuration.

Used in the header and the body of a JMS message.

AudienceLevel  The code assigned to the audience level on the Settings > Detect Settings > Audience Levels page.

Used in the body of a JMS message.

audienceId The customer ID associated with this transaction.

Used in the body of a JMS message.

inputDataSourceName The name of the data source to which the queue connector is mapped. Data sources are defined on the Settings > Detect Settings > Data Sources page.

Used in the body of a JMS message.

transaction Fields from your Transaction data source, as defined on the Settings > Detect Settings > Data Sources page.

Used in the body of a JMS message.

Note: The date must be expressed in milliseconds.

Example:


{"FLAG":true,
"DATE":1408077610000,
"AMT":1000.00,
"NUMBER":10,
"TRANCODE":"ATMD",
"CURRENCY":1009.1,
"ID":"cm00411"}

Sample code for creating a transaction message using the JMS API

Here is a sample code snippet for creating a JMS message for transaction data using the JMS API. Line breaks have been added for readability.


 //JMS Header Fields
   MapMessage message = session.createMapMessage();
   message.setLongProperty("AUDHASH",hashcode);
    message.setStringProperty("deploymentConfigurationId", 
         "eecdc1b4-5333-4076-9af6-dc6c2f932c0e");
    message.setLongProperty("inputVersion", 5);
    			
 //JMS Body Fields
    message.setString("deploymentConfigurationId", 
          "eecdc1b4-5333-4076-9af6-dc6c2f932c0e");
    message.setInt("inputVersion", 5);
    message.setString("audienceLevel", "audienceLevel");
    message.setString("audienceId", "cm00409");
    message.setString("inputDataSourceName", "DataSourceNam");
    message.setString("transaction", "{\"Date\":1408077610000,\"Amount2\":1000.00,\
          "Type\":\"E1a\",\"Amount1\":1009.1,\"ID\":\"cm00409\"}");

Example of a transaction message

This is sample input message that was sent to an Active MQ queue server. Line breaks have been added for readability.


ActiveMQMapMessage {commandId = 0, responseRequired = false, 
messageId = ID:ADMINIB-3C6H892-58046-1428399823708-0:0:1:1:1, 
originalDestination = null, 
originalTransactionId = null, 
producerId = null, 
destination = queue://amqinput, 
transactionId = null, 
expiration = 0, 
timestamp = 1428399824137, 
arrival = 0, 
brokerInTime = 0, 
brokerOutTime = 0, 
correlationId = null, 
replyTo = null, 
persistent = false, 
type = null, 
priority = 4, 
groupID = null, 
groupSequence = 0, 
targetConsumerId = null, 
compressed = false, 
userID = null, 
content = org.apache.activemq.util.ByteSequence@60945fea, 
marshalledProperties = null, 
dataStructure = null, 
redeliveryCounter = 0, 
size = 0, 
properties = {inputVersion=5, 
     deploymentConfigurationId=eecdc1b4-5333-4076-9af6-dc6c2f932c0e, 
     AUDHASH=13670}, 
     readOnlyProperties = false, 
     readOnlyBody = false, droppable = false} 
ActiveMQMapMessage
{ theTable = 
     {audienceLevel=audienceLevel, 
     audienceId=cm00409, 
     inputVersion=5, 
     transaction={"FLAG":true,
        "DATE":1408077610000,
        "AMT":1000.00,
        "NUMBER":10,
        "TRANCODE":"ATMD",
        "CURRENCY":1009.1,
        "ID":"cm00411"}
 }