#include "os.h"
#include "common.h"
#define MY_SAMPLE_REQUEST_TE "my_sample_request_te"
replierFlowRxMsgCallbackFunc (
void *user_p )
{
const char *senderId_p = NULL;
common_handleError ( rc, "solClient_msg_getSenderId()" );
goto done;
}
common_handleError ( rc, "solClient_msg_getReplyTo()");
goto done;
}
common_handleError ( rc, "solClient_flow_getTransactedSession()");
goto done;
}
printf("Replier receives a request message from '%s'. It sends a reply message and then commits the transaction.\n", senderId_p);
common_handleError ( rc, "solClient_msg_alloc()" );
goto done;
}
common_handleError ( rc, "solClient_msg_setDestination()" );
goto freeMsg;
}
common_handleError ( rc, "solClient_msg_setDeliveryMode()" );
goto freeMsg;
}
common_handleError ( rc, "solClient_transactedSession_sendMsg()" );
goto freeMsg;
}
common_handleError ( rc, "solClient_transactedSession_commit()" );
goto freeMsg;
}
freeMsg:
common_handleError ( rc, "solClient_msg_free()" );
}
done:
}
int
main ( int argc, char *argv[] )
{
struct commonOptions commandOpts;
const char *flowProps[100];
int propIndex = 0;
const char senderId[] = "Requestor";
const char *provProps[20];
printf ( "transactions.c (Copyright 2013-2024 Solace Corporation. All rights reserved.)\n" );
initSigHandler ( );
common_initCommandOptions(&commandOpts,
( USER_PARAM_MASK |
DEST_PARAM_MASK ),
( HOST_PARAM_MASK |
PASS_PARAM_MASK |
LOG_LEVEL_MASK |
USE_GSS_MASK |
ZIP_LEVEL_MASK));
if ( common_parseCommandOptions ( argc, argv, &commandOpts, NULL ) == 0 ) {
exit(1);
}
common_handleError ( rc, "solClient_initialize()" );
goto notInitialized;
}
common_printCCSMPversion ( );
&context_p,
&contextFuncInfo,
common_handleError ( rc, "solClient_context_create()" );
goto cleanup;
}
if ( ( rc = common_createAndConnectSession ( context_p,
&session_p,
common_messageReceivePrintMsgCallback,
common_eventCallback,
NULL,
common_handleError ( rc, "common_createAndConnectSession()" );
goto cleanup;
}
goto sessionConnected;
}
goto sessionConnected;
}
session_p,
&replierTransactedSession_p,
common_handleError ( rc, "solClient_session_createTransactedSession()" );
goto sessionConnected;
}
propIndex = 0;
provProps[propIndex++] = MY_SAMPLE_REQUEST_TE;
provProps[propIndex++] = "100";
provProps[propIndex++] = NULL;
session_p,
common_handleError ( rc, "solClient_session_endpointProvision()");
goto sessionConnected;
}
endpointProvisioned = TRUE;
propIndex = 0;
flowProps[propIndex++] = MY_SAMPLE_REQUEST_TE;
flowProps[propIndex++] = commandOpts.destinationName;
flowProps[propIndex] = NULL;
replierTransactedSession_p,
&replierFlow_p,
&flowFuncInfo,
common_handleError(rc, "solClient_transactedSession_createFlow()");
goto sessionConnected;
}
session_p,
&requestorTransactedSession_p,
common_handleError ( rc, "solClient_session_createTransactedSession()" );
goto sessionConnected;
}
propIndex = 0;
flowProps[propIndex] = NULL;
requestorTransactedSession_p,
&requestorFlow_p,
&flowFuncInfo,
common_handleError(rc, "solClient_transactedSession_createFlow()");
goto sessionConnected;
}
common_handleError ( rc, "solClient_msg_alloc()" );
goto sessionConnected;
}
common_handleError ( rc, "solClient_msg_setDeliveryMode()" );
goto freeMsg;
}
common_handleError ( rc, "solClient_msg_setDeliveryMode()" );
goto freeMsg;
}
destination.
dest = commandOpts.destinationName;
common_handleError ( rc, "solClient_msg_setDestination()" );
goto freeMsg;
}
common_handleError ( rc, "solClient_flow_getDestination()" );
goto freeMsg;
}
common_handleError ( rc, "solClient_msg_setDestination()" );
goto freeMsg;
}
common_handleError ( rc, "solClient_transactedSession_sendMsg()" );
goto freeMsg;
}
printf ( "Requestor sends a request message on topic '%s' and then commits the transaction.\n", commandOpts.destinationName );
common_handleError ( rc, "solClient_transactedSession_commit" );
goto freeMsg;
}
common_handleError ( rc, "solClient_flow_receiveMsg()" );
goto freeMsg;
}
printf ( "Requestor receives a reply message and commits the transaction.\n");
common_handleError ( rc, "solClient_msg_free()" );
goto freeMsg;
}
common_handleError ( rc, "solClient_transactedSession_commit" );
}
freeMsg:
common_handleError ( rc, "solClient_msg_free()" );
}
sessionConnected:
if (replierTransactedSession_p != NULL) {
common_handleError ( rc, "solClient_transactedSession_destroy()" );
}
}
if (requestorTransactedSession_p != NULL) {
common_handleError ( rc, "solClient_transactedSession_destroy()" );
}
}
if (endpointProvisioned) {
session_p,
common_handleError ( rc, "solClient_session_endpointDeprovision()");
}
}
common_handleError ( rc, "solClient_session_disconnect()" );
}
cleanup:
common_handleError ( rc, "solClient_cleanup()" );
}
goto notInitialized;
notInitialized:
return 0;
}