{
  "synLogic": "int $ret \u003d $api($1, $2, $3, $4, $5, $6, $7);",
  "help": "This code snippet is written in C programming language and is used for retrieving a message from a JMS (Java Message Service) queue or topic using a connection obtained via the \"get connection\" API. The retrieved message is stored in the \"msg\" parameter with a maximum length of \"msg_len\". Similarly, the message header is stored in the \"header\" parameter with a maximum length of \"header_len\".\n\nIn case of any error during the message retrieval process, an error code of value less than zero is returned in the \"ret\" variable, and the \"error_msg\" parameter is set with an appropriate error message (with a maximum length of 1014 characters). Some possible errors that can occur during the message retrieval process are:\n\n - Connection closed by the JMS server\n- Invalid connection ID passed\n- Transaction started with name passed if it is not NULL or empty\n- If the put operation fails, then the transaction is ended with an error code of TIBCOGetMsgError2012.",
  "notes": "In case of error, error code of value < 0 is returned and error_msg (max 1014) is set with error message\n Few possible errors are:\n  Connection closed by JMS server\n  Invalid connection ID passed\n  Transaction is started with name passed if it is not NULL or empty",
  "returns": "The ns_tibco_get_msg() function returns an integer value that indicates the status of the function execution. If the function is executed successfully, it returns 0. If there is an error in the function execution, it returns a negative value.",
  "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 A unique identifier assigned by the TIBCO server to a JMS process connector instance. \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd\u003e Message \u003c/td\u003e \u003ctd\u003e A character pointer that will contain the message retrieved from the TIBCO server. \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd\u003e Message Length \u003c/td\u003e \u003ctd\u003e he maximum length of the message that can be retrieved. \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd\u003e Header \u003c/td\u003e \u003ctd\u003e A character pointer that will contain the message header retrieved from the TIBCO server. \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd\u003e Header Length \u003c/td\u003e \u003ctd\u003e The maximum length of the message header that can be retrieved. \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd\u003e Transaction Name \u003c/td\u003e \u003ctd\u003e A character pointer that will contain the transaction name associated with the message retrieved from the TIBCO server. \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd\u003e Error Message \u003c/td\u003e \u003ctd\u003e A character pointer that will contain the error message in case of any error. \u003c/td\u003e \u003c/tr\u003e \u003c/table\u003e",
  "parameterization": "",
  "name": "ns_tibco_get_msg",
  "syntax": "int ns_tibco_get_msg(int jpcid, char *msg, int msg_len, char *header, int header_len, char *transaction_name, char *error_msg)",
  "javaSyntax": "int nsApi.ns_tibco_get_msg(int jpcid, char *msg, int msg_len, char *header, int header_len, char *transaction_name, char *error_msg)",
  "cEx": "flow()\n{\n  int jpid;	//JMS Pool Id\n  int jcid;	//JMS Connection Id\n  char header[1024];	//message to be recieved\n  int header_len = 1024;	//message length\n  char error_msg[1024 + 1];	// Error string. Must be 1024 size\n  int ret;	// Error code\n  int msg_len = 1024;\n  char msg[1024 + 1];\n\n  if((jpid = ns_tibco_init_consumer(\"ssl://127.0.0.1\", 7222, 1, \"topic\", \"user_id\", ns_decrypt(\"NlEyRDZGLUQg\"), 1,error_msg)) < 0)\n  {\n    fprintf(stderr, \"Error in initializing Tibco consumer. Error code = %d, Error Msg = %s\", jpid, error_msg);\n    return;\n  }\n\n  if((jcid = ns_tibco_get_connection(jpid, \"TIBCOConsumerSSLConnect\", 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  if((ret = ns_tibco_get_msg(jcid, msg, msg_len, header, header_len, \"TIBCOGetMsg\", error_msg)) < 0)\n  {\n    fprintf(stderr, \"Error in getting message using Tibco connention. Error code = %d, Error Msg = %s\", ret, error_msg);\n  }\n\n}",
  "javaEx": "flow()\n{\n  int jpid;	//JMS Pool Id\n  int jcid;	//JMS Connection Id\n  char header[1024];	//message to be recieved\n  int header_len = 1024;	//message length\n  char error_msg[1024 + 1];	// Error string. Must be 1024 size\n  int ret;	// Error code\n  int msg_len = 1024;\n  char msg[1024 + 1];\n\n  if((jpid = ns_tibco_init_consumer(\"ssl://127.0.0.1\", 7222, 1, \"topic\", \"user_id\", ns_decrypt(\"NlEyRDZGLUQg\"), 1,error_msg)) < 0)\n  {\n    fprintf(stderr, \"Error in initializing Tibco consumer. Error code = %d, Error Msg = %s\", jpid, error_msg);\n    return;\n  }\n\n  if((jcid = ns_tibco_get_connection(jpid, \"TIBCOConsumerSSLConnect\", 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  if((ret = ns_tibco_get_msg(jcid, msg, msg_len, header, header_len, \"TIBCOGetMsg\", error_msg)) < 0)\n  {\n    fprintf(stderr, \"Error in getting message using Tibco connention. Error code = %d, Error Msg = %s\", ret, error_msg);\n  }\n\n}",
  "insertStrC": "ns_tibco_get_msg(int jpcid, char *msg, int msg_len, char *header, int header_len, char *transaction_name, char *error_msg);",
  "insertStrJava": "nsApi.ns_tibco_get_msg(int jpcid, char *msg, int msg_len, char *header, int header_len, char *transaction_name, char *error_msg);",
  "description": "The ns_tibco_get_msg API is used to get message from the server.",
  "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": "Header",
      "labelVarCheckbox": "If header is a program variable",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter header",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "validate": {
        "inputType": "Text",
        "required": true
		}
    },
	{
      "id": "$5",
      "type": "TextField",
      "label": "Header Length",
      "labelVarCheckbox": "",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter Header length",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "validate": {
        "inputType": "Number",
        "required": true,
		"max": 2147483647,
        "min": 0
		}
    },
	{
      "id": "$6",
      "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 transaction name",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "validate": {
        "inputType": "Text",
        "required": true
		}
    },
	{
      "id": "$7",
      "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)"
      }
    }
  ]
}
