{
  "synLogic": "int $ret \u003d $api($1, $2, $3, $4, $5, $6, $7);",
  "help": "The provided api is used for receiving a message from a JMS topic using a Kafka connection. It also handles error cases and provides an error message if an error occurs. In Kafka, to consume messages from a Kafka topic, you typically use the consumer API provided by the Kafka client library. The specific method for retrieving messages depends on the programming language and client library you are using.",
  "notes": "",
  "returns": "It returns an integer value in C, If the ns_kafka_get_msg function returns a value less than 0, then an error has occurred. In this case, the code will print an error message that includes the error code and error message. In JAVA this api returns the message received from the kafka server.",
  "arguments": "\u003ctable class\u003d\"newGuiTable\" style\u003d\"width:100%\"\u003e \u003ctbody\u003e\u003ctr\u003e \u003cth\u003e Argument \u003c/th\u003e \u003cth\u003e Description \u003c/th\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd\u003e JPCID \u003c/td\u003e \u003ctd\u003e It is the Connection ID for Java Messaging Service \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd\u003e Message \u003c/td\u003e \u003ctd\u003e A pointer to a buffer that will contain the received message. \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd\u003e Message Length \u003c/td\u003e \u003ctd\u003e The length of the message buffer. \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd\u003e Header \u003c/td\u003e \u003ctd\u003e A pointer to a buffer that will contain the message header. \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd\u003e Header Length \u003c/td\u003e \u003ctd\u003e The length of the message header buffer. \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd\u003e Transaction Name \u003c/td\u003e \u003ctd\u003e The name of the transaction, which can be used to identify the error if the transaction fails. \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd\u003e Error Message \u003c/td\u003e \u003ctd\u003e A buffer to store the error message if an error occurs. \u003c/td\u003e \u003c/tr\u003e \u003c/tbody\u003e\u003c/table\u003e",
  "parameterization": "",
  "component": [
    {
      "id": "$1",
      "type": "TextField",
      "label": "JMS Pool Connection Id",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "First character must be Alpha.\r\nOther characters are Alpha, Numeric or Underscore",
      "placeHolder": "",
      "isDisabled": "",
      "labelVarCheckbox": "If JMS Connection id is a program variable",
      "argIndex": 0,
      "validate": {
        "inputType": "Text",
        "disabled": false,
        "pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,63}$",
        "required": false,
        "min": 0,
        "max": 0,
        "method": "isValidVar(arg)"
      },
      "quotes": false
    },
    {
      "id": "$2",
      "type": "TEXT_VAR",
      "label": "Message",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter message",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "labelVarCheckbox": "If message is a program variable",
      "argIndex": 0,
      "validate": {
        "inputType": "Text",
        "disabled": false,
        "required": true,
        "min": 0,
        "max": 0
      },
      "quotes": true
    },
    {
      "id": "$3",
      "type": "TextField",
      "label": "Message Length",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter message length",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "labelVarCheckbox": "",
      "argIndex": 0,
      "validate": {
        "inputType": "Number",
        "disabled": false,
        "required": true,
        "min": 0,
        "max": 2147483647
      },
      "quotes": true
    },
    {
      "id": "$4",
      "type": "TEXT_VAR",
      "label": "Header",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter header",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "labelVarCheckbox": "If header is a program variable",
      "argIndex": 0,
      "validate": {
        "inputType": "Text",
        "disabled": false,
        "required": true,
        "min": 0,
        "max": 0
      },
      "quotes": true
    },
    {
      "id": "$5",
      "type": "TextField",
      "label": "Header Length",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter Header length",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "labelVarCheckbox": "",
      "argIndex": 0,
      "validate": {
        "inputType": "Number",
        "disabled": false,
        "required": true,
        "min": 0,
        "max": 2147483647
      },
      "quotes": true
    },
    {
      "id": "$6",
      "type": "TEXT_VAR",
      "label": "Transaction Name",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter transaction name",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "labelVarCheckbox": "If transaction name is a program variable",
      "argIndex": 0,
      "validate": {
        "inputType": "Text",
        "disabled": false,
        "required": true,
        "min": 0,
        "max": 0
      },
      "quotes": true
    },
    {
      "id": "$7",
      "type": "TextField",
      "label": "Error Message Buffer Pointer",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter error message",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "labelVarCheckbox": "",
      "argIndex": 0,
      "validate": {
        "inputType": "Text",
        "disabled": false,
        "required": true,
        "min": 0,
        "max": 0
      },
      "quotes": false
    },
    {
      "id": "$ret",
      "type": "TextField",
      "label": "Return Variable",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "First character must be Alpha.\r\nOther characters are Alpha, Numeric or Underscore.",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "labelVarCheckbox": "",
      "argIndex": 0,
      "validate": {
        "inputType": "Text",
        "disabled": false,
        "pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,63}$",
        "required": false,
        "min": 0,
        "max": 0,
        "method": "isValidVar(arg)"
      },
      "quotes": true
    }
  ],
  "name": "ns_kafka_get_msg",
  "syntax": "int ns_kafka_get_msg(int jpcid, char *msg, int msg_len, char *header, int hdr_len,  char *transaction_name, char *error_msg);",
  "javaSyntax": "String ns_kafka_get_msg(JMSKey key, String txName);",
  "cEx": "flow()\n{\n  int jpid;        //JMS Pool Id\n  int jcid;        //JMS Connection Id\n  char error_msg[1024 + 1];        // Error string. Must be 1024 size\n  int ret;        // Error code\n  int msg_len \u003d 1024;\n  char msg[1024 + 1];\n  int hdr_len \u003d 1024;\n  char header[1024 + 1];\n\n  if((jpid \u003d ns_kafka_init_consumer(\"127.0.0.1\", 9092, \"topic\", \"consumer_group\", 5, error_msg)) \u003c 0)\n  {\n    fprintf(stderr, \"Error in initializing Kafka Consumer. Error code \u003d %d, Error Msg \u003d %s\", jpid, error_msg);\n    return;\n  }\n\n  if((jcid \u003d ns_kafka_get_connection(jpid, \"KAFKAConsumerSSLConnect\", error_msg)) \u003c 0)\n  {\n    fprintf(stderr, \"Error in getting Kafka connention. Error code \u003d %d, Error Msg \u003d %s\", jcid, error_msg);\n    return;\n  }\n\n  if((ret \u003d ns_kafka_get_msg(jcid, msg, msg_len, header, hdr_len, \"KAFKAGetMsg\", error_msg)) \u003c 0)\n  {\n    fprintf(stderr, \"Error in Receiving message using Kafka connention. Error code \u003d %d, Error Msg \u003d %s\", ret, error_msg);\n  }\n}",
  "javaEx": "public class flow implements NsFlow\n{\n  public int execute(NSApi nsApi) throws Exception\n  {\n        NSApi.JMSKey key \u003d null;\n        String msg\u003dnull;\n\n        // Gets message in the JMS topic using connection ID returned from get connection api\n        // In case of error, it returns error code with error_msg (see help for details)\n        // Here Transaction is set with name passed in sixth argument . for example here it sets KAFKAPutMsg\n        // If api fails, then transaction is set with . For example, KAFKAPutMsgConnectTimeout\n        if((msg \u003d nsApi.ns_kafka_get_msg(key, \"KAFKAGetMsg\")) \u003d\u003d null)\n        {\n         System.out.println(\"Error in getting message using kafka connection. Error code \u003d \" + key.getErrCode() + \", Error Msg \u003d \" + key.getErrMsg());\n        }\n  }\n}",
  "insertStrC": "ns_kafka_get_msg(int jpcid, char *msg, int msg_len, char *header, int hdr_len,  char *transaction_name, char *error_msg);",
  "insertStrJava": "ns_kafka_get_msg(JMSKey key, String txName);",
  "description": "The provided api is used for receiving a message from a JMS topic using a Kafka connection. It also handles error cases and provides an error message if an error occurs. In Kafka, to consume messages from a Kafka topic, you typically use the consumer API provided by the Kafka client library. The specific method for retrieving messages depends on the programming language and client library you are using."
}