{
  "synLogic": "int $ret \u003d $api($1, $2, $3, $4, $5);",
  "help": "This code snippet is a simple example of how to publish a message using the Tibco middleware. The code uses a function ns_tibco_put_msg to publish the message and prints an error message if there is any error while publishing the message. \nFew possible errors are: \nConnection closed by JMS server \nInvalid connection ID passed \n\nTransaction is started with name passed if it is not NULL or empty \nIf put fails, then transaction is ended with \u003cTxName\u003eError\u003cJMSErrorCode\u003e. For example, TIBCOPutMsgError2012",
  "notes": "",
  "returns": "In case of error, error code of value \u003c 0 is returned and error_msg (max 1014) is set with error message.",
  "arguments": "\u003ctable class\u003d\"newGuiTable\" style\u003d\"width:100%\" \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 This is a connection ID returned by the Tibco middleware \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd\u003e Message \u003c/td\u003e \u003ctd\u003e This is a pointer to the message buffer that needs to be published. \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd\u003e Message Length \u003c/td\u003e \u003ctd\u003e This is the length of the message buffer. \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd\u003e Trasaction Name \u003c/td\u003e \u003ctd\u003e This is the subject/topic on which the message needs to be published. \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd\u003e Error Message \u003c/td\u003e \u003ctd\u003e This is a pointer to the buffer that will store the error message in case of any error. \u003c/td\u003e \u003c/tr\u003e \u003c/table\u003e",
  "parameterization": "",
  "name": "ns_tibco_put_msg",
  "syntax": "int ns_tibco_put_msg(int jpcid, char *msg, int msg_len, char *transaction_name, char *error_msg )",
  "javaSyntax": "int ns_tibco_put_msg(int jpcid, char *msg, int msg_len, char *transaction_name, char *error_msg )",
  "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 = \"messag will goes here\";	// Message to be produced\n  int msg_len = strlen(msg);	// Message Length\n\n  if((jpid = ns_tibco_init_producer(\"ssl://127.0.0.1\", 7222, 1, \"topic\", \"user_id\", ns_decrypt(\"NlEyRDJeMFI=\"), 1, error_msg)) < 0)\n  {\n    fprintf(stderr, \"Error in initializing Tibco producer. Error code = %d, Error Msg = %s\", jpid, error_msg);\n    return;\n  }\n\n  if((jcid = ns_tibco_get_connection(jpid, \"TIBCOProducerSSLConnect\", error_msg)) < 0)\n  {\n    fprintf(stderr, \"Error in getting Tibco connention. Error code = %d, Error Msg = %s\", jcid, error_msg);\n    return;\n  }\n\n  if((ret = ns_tibco_put_msg(jcid, msg, msg_len, \"TIBCOPutMsg\", error_msg)) < 0)\n  {\n    fprintf(stderr, \"Error in putting message using Tibco connention. Error code = %d, Error Msg = %s\", ret, error_msg);\n  }\n}",
  "javaEx": "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 = \"messag will goes here\";	// Message to be produced\n  int msg_len = strlen(msg);	// Message Length\n\n  if((jpid = ns_tibco_init_producer(\"ssl://127.0.0.1\", 7222, 1, \"topic\", \"user_id\", ns_decrypt(\"NlEyRDJeMFI=\"), 1, error_msg)) < 0)\n  {\n    fprintf(stderr, \"Error in initializing Tibco producer. Error code = %d, Error Msg = %s\", jpid, error_msg);\n    return;\n  }\n\n  if((jcid = ns_tibco_get_connection(jpid, \"TIBCOProducerSSLConnect\", error_msg)) < 0)\n  {\n    fprintf(stderr, \"Error in getting Tibco connention. Error code = %d, Error Msg = %s\", jcid, error_msg);\n    return;\n  }\n\n  if((ret = ns_tibco_put_msg(jcid, msg, msg_len, \"TIBCOPutMsg\", error_msg)) < 0)\n  {\n    fprintf(stderr, \"Error in putting message using Tibco connention. Error code = %d, Error Msg = %s\", ret, error_msg);\n  }\n}",
  "insertStrC": "ns_tibco_put_msg(int jpcid, char *msg, int msg_len, char *transaction_name, char *error_msg );",
  "insertStrJava": "ns_tibco_put_msg(int jpcid, char *msg, int msg_len, char *transaction_name, char *error_msg );",
  "description": "The ns_tibco_put_msg API is used to put message in the JMS queue/topic using connection taken using ns_tibco_get_connection API.",
  "component": [
    {
      "id": "$1",
      "type": "TextField",
      "label": "JMS Connection Pool Id",
      "labelVarCheckbox": "",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter jpcid",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "validate": {
        "inputType": "Number",
        "required": true,
		"max": 2147483647,
        "min": 0
		}
    },
	{
      "id": "$2",
      "type": "TEXT_VAR",
      "label": "Message",
      "labelVarCheckbox": "If message is a program variable",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter message",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "validate": {
        "inputType": "Text",
        "required": true
		}
    },
	{
      "id": "$3",
      "type": "TextField",
      "label": "Message Length",
      "labelVarCheckbox": "",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter message length",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "validate": {
        "inputType": "Number",
        "required": true,
		"max": 2147483647,
        "min": 0
		}
    },
	{
      "id": "$4",
      "type": "TEXT_VAR",
      "label": "Transaction Name",
      "labelVarCheckbox": "If transaction name is a program variable",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter error message",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "validate": {
        "inputType": "Text",
        "required": true
		}
    },
	{
      "id": "$5",
      "type": "TEXT_VAR",
      "label": "Error message",
      "labelVarCheckbox": "If error message is a program variable",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter error message",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "validate": {
        "inputType": "Text",
        "required": true
		}
    },
    {
      "id": "$ret",
      "type": "TextField",
      "label": "Return Variable",
      "labelVarCheckbox": "",
      "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": "",
      "validate": {
        "inputType": "Text",
	"pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,63}$",
        "required": false,
        "method": "isValidVar(arg)"
      }
    }
  ]
}
