Submits a message to the Message Feed server. Before submitting a message, the mfp_Authenticate
function must be called to authenticate to the server. A message is submitted to a specified activity. The message consists of data and attributes and is optionally identified by a message ID.
int mfp_SubmitMessage (h_mfp hMFP, int RequestId, char const* pIntegration, char const* pActivity, char const* pFilePath, t_mfpattribute** ppAttributes, char const* pMessageId, int Acknowledge, int Timeout);
hMFP
– The handle to the Message Feed connection.RequestId
– Identifies this request. It is returned in the reply received by the mfp_GetReply
function in order to correlate a reply with its request.pIntegration
– Specifies in which integration the activity exists. This is a qualified name containing any folders and integration name separated by the slash (/) character. The sequence \\ is used to specify a single \ character in a folder or integration name. The sequence \/ is used to specify a single / character in the folder or integration name.pActivity
– Specifies the name of the activity in which the submitted message should be processed.pFilePath
– The file path to the data part of the message being submitted. The file being referred is automatically deleted after it has been submitted.ppAttributes
– An array of pointers to attribute structures of type t_mfpattribute
as defined below. The array must be ended with a NULL pointer. This parameter can be NULL in case no attributes are provided.
typedef struct { char* pName; char* pValue; } t_mfpattribute; |
pMessageId
– Identifies the message with a user-defined message identifier. This parameter can be NULL in case no message identifier is provided.Acknowledge
– Specifies the type of acknowledgement being expected for the submitted message. It can be any of:MFP_SUBMITMESSAGE_ACKNOWLEDGE_COMMIT
– Expect that the submitted message is successfully queued and secured in the Message Feed server.MFP_SUBMITMESSAGE_ACKNOWLEDGE_STATUS
– Expect a reply status for the submitted message. MFP_SUBMITMESSAGE_ACKNOWLEDGE_STATUSMESSAGE
– Expect a reply message for the submitted message. This functionality is not available in version 1.0 of Message Feed.Timeout
– Specifies the timeout, in seconds, for processing the submitted message in the specified activity.
... t_mfpattribute Attribute; t_mfpattributes* ppAttributes[2]; char const* pStatusDescription; Attribute.pName = "MyAttribute"; Attribute.pValue = "somedata"; ppAttributes[0] = &Attribute; ppAttributes[1] = NULL; if(mfp_SubmitMessage(hMFP, 0, "MyFolder/MyIntegration", "MyActivity", "Id123", "msg.dat", ppAttributes, MFP_SUBMITMESSAGE_ACKNOWLEDGE_STATUS, 600) != 0) { printf("failed to submit message: %s\n", mfp_GetLastError()); exit(1);
} pReply = mfp_GetReply(hMFP, 60); if(pReply == NULL) { printf("failed to get submit message reply: %s\n", mfp_GetLastError()); exit(1); } if(pReply->Status != MFP_REPLYSTATUS_OK) { printf("failed to submit message: %s\n", mfp_StatusToString(pReply->Status)); exit(1); } switch(pReply->SubmitMessage.Status) { case MFP_SUBMITMESSAGE_STATUS_OK: pStatusDescription = "Ok"; break; case MFP_SUBMITMESSAGE_STATUS_PARTIALERROR: pStatusDescription = "Partial error"; break; case MFP_SUBMITMESSAGE_STATUS_ERROR: pStatusDescription = "Error"; break;
case MFP_SUBMITMESSAGE_STATUS_TIMEOUT: pStatusDescription = "Timeout"; break; default: pStatusDescription = "Unknown"; break; } printf("LoggerId\t%s\n", pReply->SubmitMessage.pLoggerId); printf("Status\t%s\n", pStatusDescription); mfp_FreeReply(pReply); ... |