How to retrieve named field value inside RV message received by Hawk msghma

How to retrieve named field value inside RV message received by Hawk msghma

book

Article ID: KB0090475

calendar_today

Updated On:

Products Versions
TIBCO Hawk -
Not Applicable -

Description

Resolution:
Hawk agent has a messaging microagent using the configuration file at hawk/bin/msghma.xml. You can update the file to config a method that listens to RV messages sent on the Hawk default transport bus. Let's say you want to retrieve the content of the 'command' field in the following RV message:
2006-11-25 12:54:15 (2006-11-25 17:54:15.328000000Z): subject=rt10.voicert.algorithm.command, message={command="C:\WINDOWS\execAlgorithm.sh /mnt/dev/jobs/jobxyz"}

You can add a method onMessageCommand like below:
  &ltmethod
    name = "onMessageCommand"
    help = "Receive a message with a 'command' field having a string value. "
    handlerType = "SU"
  >
    &ltinputParameter
      name = "Subject"
      help = "Message subject"
      type = "STRING"
    >
      &ltvalueChoices
          value = "_HAWK.${domainName}.msghma.data">
      </valueChoices>
    </inputParameter>
    &ltoutputParameter
      name = "Subscription Subject"
      help = "Subscription Subject"
      type = "STRING"
    >
    </outputParameter>
    &ltoutputParameter
      name = "Message Subject"
      help = "Message Subject"
      type = "STRING"
    >
    </outputParameter>
    &ltoutputParameter
      name = "command"
      help = "Command Field Data"
      type = "STRING"
    >
    </outputParameter>
  </method>

Make sure the handlerType="SU" not "DS".

The result is that you would get one of the output field containing: "C:\WINDOWS\execAlgorithm.sh /mnt/dev/jobs/jobxyz". If you use "DS" as handlerType, you would get 'command="C:\WINDOWS\execAlgorithm.sh /mnt/dev/jobs/jobxyz"' as content of the output field.

Issue/Introduction

How to retrieve named field value inside RV message received by Hawk msghma