Gets the reply to a request to the Message Feed server.
The mfp_GetReply function is blocking. To avoid blocking the program while waiting for the reply, use the mfp_GetSocket function to obtain a socket that can be used in the C select function to wait for the socket to be ready for read or write access. To avoid memory leaks, use the mfp_FreeReply function to free the reply structure.
t_mfpreply* mfp_GetReply(h_mfp hMFP, int Timeout);
hMFP – Handle to the Message Feed connection.Timeout – Timeout, in seconds, to wait for the reply. This timeout is not the same timeout as the socket access timeout which is defined in the mfp_Connect function. t_mfpreply as defined below. This structure must be freed using the mfp_FreeReply function. A NULL value is returned in case of an error.mfp_GetLastError function to get a textual description of the error:|
typedef struct { int RequestType; int RequestId; int Status; t_mfpreply_submitmsg SubmitMessage; } t_mfpreply; |
t_mfpreply structure is one of the following:RequestId field in the t_mfpreply structure is the same request id as supplied in the mfp_Authenticate or mfp_SubmitMessage function.t_mfpreply structure is the status of the request. You can use the mfp_StatusToString function to get a textual description of the status. The status can be any of the following: t_mfpreply structure is valid in case the reply is related to a mfp_SubmitMessage request. This field is a structure of type t_mfpreply_submitmsg as defined below.|
typedef struct { char* pFilePath; char* pMessageId; char* pLoggerId; int Status; } t_mfpreply_submitmsg; |
pFilePath parameter in the t_mfpreply_submitmsg structure is only set in case a reply message was requested in the mfp_SubmitMessage function. In this case, this field specifies the file path to the reply message.pMessageId parameter in the t_mfpreply_submitmsg structure specifies the user defined message ID of the message being submitted. This is the same as the MessageId parameter in the mfp_SubmitMsg function.pLoggerId parameter in the t_mfpreply_submitmsg structure specifies the logger ID assigned for the submitted message by the Message Feed server. The logger ID uniquely identifies a message in the integration engine.Status parameter in the t_mfpreply_submitmsg structure specifies the processing status of the submitted message. The status can be any of the following:|
#include "mfp.h" ... h_mfp hMFP; t_mfpreply* pReply; hMFP = mfp_Connect("localhost", "12345", 60); if(hMFP == NULL) { printf("failed to connect to Message Feed server: %s\n", mfp_GetLastError()); exit(1); } if(mfp_Authenticate(hMFP, 0, "user", "passwd") < 0) { printf("failed to authenticate to Message Feed server: %s\n", mfp_GetLastError()); exit(1); } pReply = mfp_GetReply(hMFP, 60); if(pReply == NULL) { printf("failed to get authentication reply: %s\n", mfp_GetLastError()); exit(1); } if(pReply->Status != MFP_REPLYSTATUS_OK) { printf("failed to authenticate: %s\n", mfp_StatusToString(pReply->Status)); exit(1); } mfp_FreeReply(pReply); mfp_Disconnect(hMFP); ... |