{
  "synLogic": "int $ret \u003d $api($1, $2, $3, $4, $5, $6);",
  "help": "This api initializes a Kafka consumer configuration with the given parameters and establishes a connection pool of size pool_size. It returns a JMS Pool ID which will be used to obtain a connection from the pool.",
  "notes": "",
  "returns": "If the initialization is successful, the function returns a JMS Pool ID, which can be used to obtain a connection from the connection pool. If there is an error, the function returns an error code less than 0, and the error_msg variable will contain an error message.  In Java this api returns an instance of JMSKey to be used in other apis for reusing producer/consumer objects or setting any producer configuration. ",
  "arguments": "\u003ctable class\u003d\"newGuiTable\" style\u003d\"width:100%\"\u003e \u003ctbody\u003e\u003ctr\u003e         \u003cth\u003eArgument\u003c/th\u003e     \u003cth\u003eDescription\u003c/th\u003e     \u003c/tr\u003e              \u003ctr\u003e    \u003ctd\u003eHost Name\u003c/td\u003e     \u003ctd\u003e    It is the Kafka Server IP / Host name. It is a mandatory field.        \u003c/td\u003e     \u003c/tr\u003e  \u003ctr\u003e       \u003ctd\u003ePort\u003c/td\u003e     \u003ctd\u003e It is the port where Kafka is listening. It is a mandatory field.        \u003c/td\u003e     \u003c/tr\u003e     \u003ctr\u003e    \u003ctd\u003eTopic\u003c/td\u003e     \u003ctd\u003e It is used as a message oriented middleware that is responsible to hold and deliver messages. It is a mandatory field. \u003c/td\u003e     \u003c/tr\u003e  \u003ctr\u003e    \u003ctd\u003eConsumer Group\u003c/td\u003e     \u003ctd\u003e  It is a multi-threaded or multi-machine consumption from Kafka topics. It provides Kafka the flexibility to have the advantages of both message queuing and publish-subscribe models. A consumer group has a unique id. Each consumer group is a subscriber to one or more Kafka topics. It is a mandatory field on selecting Consumer option.\u003c/td\u003e     \u003c/tr\u003e  \u003ctr\u003e    \u003ctd\u003ePool Size\u003c/td\u003e     \u003ctd\u003e            It is the maximum number of connections. The user can specify a maximum of 65535 connections.         \u003c/td\u003e     \u003c/tr\u003e  \u003ctr\u003e    \u003ctd\u003eError Message\u003c/td\u003e     \u003ctd\u003e A character array of length 1014 to store any error messages in case of failure. \u003c/td\u003e     \u003c/tr\u003e  \u003c/tbody\u003e\u003c/table\u003e",
  "parameterization": "",
  "component": [
    {
      "id": "$1",
      "type": "TextField",
      "label": "Host Name",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter Host Name",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "labelVarCheckbox": "If host name is a program variable.",
      "argIndex": 0,
      "validate": {
        "inputType": "Text",
        "disabled": false,
        "required": true,
        "min": 0,
        "max": 0
      },
      "quotes": true
    },
    {
      "id": "$2",
      "type": "TextField",
      "label": "Port",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter port",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "labelVarCheckbox": "",
      "argIndex": 0,
      "validate": {
        "inputType": "Number",
        "disabled": false,
        "required": true,
        "min": 0,
        "max": 2147483647
      },
      "quotes": true
    },
    {
      "id": "$3",
      "type": "TextField",
      "label": "Topic",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter topic",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "labelVarCheckbox": "If topic is a program variable.",
      "argIndex": 0,
      "validate": {
        "inputType": "Text",
        "disabled": false,
        "required": true,
        "min": 0,
        "max": 0
      },
      "quotes": true
    },
    {
      "id": "$4",
      "type": "TextField",
      "label": "Consumer Group",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter consumer group",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "labelVarCheckbox": "If consumer group is a program variable.",
      "argIndex": 0,
      "validate": {
        "inputType": "Text",
        "disabled": false,
        "required": true,
        "min": 0,
        "max": 0
      },
      "quotes": true
    },
    {
      "id": "$5",
      "type": "TextField",
      "label": "Pool Size",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter pool size",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "labelVarCheckbox": "",
      "argIndex": 0,
      "validate": {
        "inputType": "Number",
        "disabled": false,
        "required": true,
        "min": 0,
        "max": 2147483647
      },
      "quotes": true
    },
    {
      "id": "$6",
      "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_init_consumer",
  "syntax": "int ns_kafka_init_consumer(char *kafka_hostname, int kafka_port, char *kafka_topic, char *consumer_group, int max_pool_size, char *error_msg);",
  "javaSyntax": "JMSKey ns_kafka_init_consumer(String kafka_hostname, int kafka_port, String kafka_topic, String consumer_group, int max_pool_size, String schemaRegistryUrl);",
  "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}",
  "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        // Initializes JMS Pool with given pool size and arguments\n        // It returns a Pool ID which need to be passed in subsequent api for getting connection from the pool\n        if((key \u003d nsApi.ns_kafka_init_consumer(\"127.0.0.1\",9092,\"Topic\",\"Consumer Group\",1,null)) \u003d\u003d null)\n        {\n         System.out.println(\"Error in initializing kafka consumer. Issue while initialising Look Up Table or with key insertion in it.\");\n         return 0;\n        }\n  }\n}",
  "insertStrC": "ns_kafka_init_consumer(char *kafka_hostname, int kafka_port, char *kafka_topic, char *consumer_group, int max_pool_size, char *error_msg);",
  "insertStrJava": "ns_kafka_init_consumer(String kafka_hostname, int kafka_port, String kafka_topic, String consumer_group, int max_pool_size, String schemaRegistryUrl);",
  "description": "This api initializes a Kafka consumer configuration with the given parameters and establishes a connection pool of size pool_size. It returns a JMS Pool ID which will be used to obtain a connection from the pool."
}