{
  "synLogic": "int $ret \u003d $api($1, $2, $3, $4, $5);",
  "help": "This API initializes a JMS connection pool with the given Kafka producer configuration. The connection pool manages a pool of Kafka producers that can be used for sending and receiving messages from a Kafka server. The pool is created with a maximum pool size specified by pool_size. The connection pool allows for efficient reuse of Kafka producers, enabling better performance and resource management.",
  "notes": "",
  "returns": "This api returns a init JMS Pool ID if successful, and a negative error code \u003c 0 otherwise for failure. 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\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 size 1014 to store the error message 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": "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": "$5",
      "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_producer",
  "syntax": "int ns_kafka_init_producer(char *kafka_hostname, int kafka_port, char *kafka_topic, int max_pool_size, char *error_msg);",
  "javaSyntax": "JMSKey ns_kafka_init_producer(String kafka_hostname, int kafka_port, String kafka_topic, 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  char *msg \u003d \"Message will goes here\";        // Message to be produced\n  int msg_len \u003d strlen(msg);        // Message Length\n  char *key \u003d \"message_key\";        // Message Key\n  int key_length \u003d strlen(key);             // Message Length\n\n  if((jpid \u003d ns_kafka_init_producer(\"127.0.0.1\", 9092, \"topic\", 5, error_msg)) \u003c 0)\n  {\n    fprintf(stderr, \"Error in initializing Kafka producer. 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 msgToBeProduce \u003d \"message\";\n        String msgKey \u003d \"message key\";\n\n        // Initializes kafka producer with given parameters and connection pool of given pool_size\n        // It returns a key (LookUp Table Key + Connection Pool Id) which need to be passed for getting connection from the pool\n        // In case of error, error code of value \u003c 0 is returned and error_msg (max 1014) is set with error message\n        if((key \u003d nsApi.ns_kafka_init_producer(\"127.0.0.1\", 9092, \"topic\", 1, null)) \u003d\u003d null)\n        {\n          System.out.println(\"Error in initializing kafka producer. Issue while initialising Look Up Table or with key insertion in it.\");\n          return 0;\n        }\n        return;\n  }\n}",
  "insertStrC": "ns_kafka_init_producer(char *kafka_hostname, int kafka_port, char *kafka_topic, char *kafka_userId,char *kafka_password, int max_pool_size, char *error_msg);",
  "insertStrJava": "ns_kafka_init_producer(String kafka_hostname, int kafka_port, String kafka_topic, int max_pool_size, String schemaRegistryUrl);",
  "description": "This API initializes a JMS connection pool with the given Kafka producer configuration. The connection pool manages a pool of Kafka producers that can be used for sending and receiving messages from a Kafka server. The pool is created with a maximum pool size specified by pool_size. The connection pool allows for efficient reuse of Kafka producers, enabling better performance and resource management."
}