#include "os.h"
#include "common.h"
int
main ( int argc, char *argv[] )
{
struct commonOptions commandOpts;
const char *cacheProps[20];
int propIndex = 0;
printf ( "\nsyncCacheRequest.c (Copyright 2009-2024 Solace Corporation. All rights reserved.)\n" );
initSigHandler ( );
common_initCommandOptions(&commandOpts,
( USER_PARAM_MASK |
CACHE_PARAM_MASK),
( HOST_PARAM_MASK |
DEST_PARAM_MASK |
PASS_PARAM_MASK |
LOG_LEVEL_MASK |
USE_GSS_MASK |
ZIP_LEVEL_MASK));
if ( common_parseCommandOptions ( argc, argv, &commandOpts, NULL ) == 0 ) {
exit(1);
}
if ( commandOpts.destinationName[0] == ( char ) 0 ) {
strncpy (commandOpts.destinationName, COMMON_MY_SAMPLE_TOPIC, sizeof(commandOpts.destinationName));
}
common_handleError ( rc, "solClient_initialize()" );
goto notInitialized;
}
common_printCCSMPversion ( );
&context_p, &contextFuncInfo,
sizeof ( contextFuncInfo ) ) ) !=
SOLCLIENT_OK ) {
common_handleError ( rc, "solClient_context_create()" );
goto cleanup;
}
if ( ( rc = common_createAndConnectSession ( context_p,
&session_p,
common_messageReceivePrintMsgCallback,
common_eventCallback, NULL, &commandOpts ) ) !=
SOLCLIENT_OK ) {
common_handleError ( rc, "common_createAndConnectSession()" );
goto cleanup;
}
common_handleError ( rc, "common_publishMessage()" );
goto sessionConnected;
}
propIndex = 0;
cacheProps[propIndex++] = commandOpts.cacheName;
cacheProps[propIndex] = NULL;
common_handleError ( rc, "solClient_session_createCacheSession" );
goto sessionConnected;
}
printf ( "Sending cache request.\n\n" );
commandOpts.destinationName,
cacheRequestId, NULL, &session_p, cacheFlags, 0 ) ) !=
SOLCLIENT_OK ) {
common_handleError ( rc, "solClient_cacheSession_sendCacheRequest()" );
goto cleanupCache;
}
printf ( "Cache request sent.\n\n" );
cleanupCache:
common_handleError ( rc, "solClient_cacheSession_destroy()" );
}
printf ( "Exiting.\n" );
sessionConnected:
common_handleError ( rc, "solClient_session_disconnect()" );
}
cleanup:
common_handleError ( rc, "solClient_cleanup()" );
}
notInitialized:
return 0;
}