{
  "synLogic": "int $ret \u003d $api($1, $2, $3);",
  "help": "This api is used to set the message mode for producing messages to a Kafka topic. Depending on the implementation, there could be several message modes available such as: synchronous or asynchronous modes.",
  "notes": "",
  "returns": "Returns 0 if the header was successfully added, or -1 if an error occurred in C, It returns boolean in Java.",
  "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 JPID \u003c/td\u003e \u003ctd\u003e It is the pool id returned from ns_kafka_init_producer () or ns_kafka_init_consumer () api. \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd\u003e Put Mode \u003c/td\u003e \u003ctd\u003e There are following put_mode available: <br /><br /><b>NS_KAFKA_FIRE_AND_FORGET</b> (default): In this mode, the producer will send and forget about acknowledgment i.e asynchronous without callback. Enter this string as is for setting this as the put mode option. Pass 0 or <b>NS_KAFKA_FIRE_AND_FORGET</b> in place of int mode to select this put_mode. <br /><br /><b>NS_KAFKA_ASYNC_WITH_CALLBACK</b>: This mode producer will send messages asynchronously with a callback which will have an acknowledgment of the message revived by kafka broker. Enter this string as is for setting this as the put mode option. Pass 1 or <b>NS_KAFKA_ASYNC_WITH_CALLBACK</b> in place of int mode to select this put_mode. <br /><br /><b>NS_KAFKA_ASYNC_WITH_CALLBACK_AND_TIMEOUT</b>: This mode is the same as above, the only difference is message will be timed out if acknowledgement is not received within the specified timeout (default 5 sec) you can the change default timeout value using this api ns_kafka_set_putMsg_timeout (key, timeout_in_sec). Enter this string as is for setting this as the put mode option. Pass 2 or <b>NS_KAFKA_ASYNC_WITH_CALLBACK_AND_TIMEOUT</b> in place of int mode to select this put_mode. <br />Note: This is only supported in Java.<br /><br /><b>NS_KAFKA_SYNC</b>: In this mode, the message will be sent synchronously and wait for acknowledgement with ack = all. Pass 3 or <b>NS_KAFKA_SYNC</b> in place of int mode to select this put_mode.<br />Note: This is only supported in Java \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd\u003e Error Message \u003c/td\u003e \u003ctd\u003e Output parameter that is used to provide information about any errors that occur during the execution. \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": "",
      "style": "",
      "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": "Dropdown",
      "label": "Put Mode",
      "value": "NS_KAFKA_FIRE_AND_FORGET",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter Put Mode",
      "placeHolder": "Select Put Mode",
      "style": "",
	  "quotes": false,
      "isDisabled": "",
      "list": [
        {
          "label": "NS_KAFKA_FIRE_AND_FORGET",
          "value": "NS_KAFKA_FIRE_AND_FORGET"
        },
        {
          "label": "NS_KAFKA_ASYNC_WITH_CALLBACK",
          "value": "NS_KAFKA_ASYNC_WITH_CALLBACK"
        },
        {
          "label": "NS_KAFKA_ASYNC_WITH_CALLBACK_AND_TIMEOUT",
          "value": "NS_KAFKA_ASYNC_WITH_CALLBACK_AND_TIMEOUT"
        },
		{
          "label": "NS_KAFKA_SYNC",
          "value": "NS_KAFKA_SYNC"
        }
      ],
      "labelVarCheckbox": "",
      "argIndex": 0,
      "validate": {
        "inputType": "text",
        "disabled": false,
        "required": true,
        "min": 0,
        "max": 0
      }
    },
    {
      "id": "$3",
      "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_set_put_msg_mode",
  "syntax": "int ns_kafka_set_put_msg_mode(int jpid, int put_mode, char *error_msg);",
  "javaSyntax": "boolean ns_kafka_set_put_msg_mode(JMSKey key, int mode);",
  "cEx": "flow()\n{\n  int jpid \u003d 12345;\n  char* error_msg \u003d \"An error occurred\";\n\n  int ret \u003d ns_kafka_set_put_msg_mode(jpid, NS_KAFKA_ASYNC_WITH_CALLBACK, error_msg);\n  if (ret \u003d\u003d 0) {\n    printf(\"Success\");\n  } else {\n    printf(\"Error\");\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\n        if(!nsApi.ns_kafka_set_put_msg_mode(key, NS_KAFKA_ASYNC_WITH_CALLBACK))\n        {\n         System.out.println(\"Error in setting put message mode. Error code \u003d \" + key.getErrCode() + \", Error Msg \u003d \" + key.getErrMsg());\n         return 0;\n        }\n  }\n}",
  "insertStrC": "ns_kafka_set_put_msg_mode(int jpid, int put_mode, char *error_msg);",
  "insertStrJava": "ns_kafka_set_put_msg_mode(JMSKey key, int mode);",
  "description": "This api is used to set the message mode for producing messages to a Kafka topic. Depending on the implementation, there could be several message modes available such as: synchronous or asynchronous modes."
}