#include "os.h"
#include "common.h"
int
main ( int argc, char *argv[] )
{
struct commonOptions commandOpts;
const char *topic_str = "sample/topic/pasta";
static const char subscriptionManager[] = "Subscription Manager";
static const char subscriptionClient[] = "Subscription Client";
const char *props[40];
int propIndex;
printf ( "\nsubscribeOnBehalfOfClient.c (Copyright 2010-2024 Solace Corporation. All rights reserved.)\n" );
initSigHandler ( );
common_initCommandOptions(&commandOpts,
( USER_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,
sizeof ( contextFuncInfo ) ) ) !=
SOLCLIENT_OK ) {
common_handleError ( rc, "solClient_context_create()" );
goto cleanup;
}
if ( ( rc = common_createAndConnectSession ( context_p,
&sessionMgr_p,
common_messageReceivePrintMsgCallback,
common_eventCallback,
(
void * ) subscriptionManager, &commandOpts ) ) !=
SOLCLIENT_OK ) {
common_handleError ( rc, "common_createAndConnectSession()" );
goto cleanup;
}
if ( ( rc = common_createAndConnectSession ( context_p,
&sessionClient_p,
common_messageReceivePrintMsgCallback,
common_eventCallback,
(
void * ) subscriptionClient, &commandOpts ) ) !=
SOLCLIENT_OK ) {
common_handleError ( rc, "common_createAndConnectSession()" );
goto cleanup;
}
printf ( "Subscription Manager Not Supported. Exiting" );
goto sessionConnected;
} else {
}
common_handleError ( rc, "solClient_session_getProperty()" );
goto sessionConnected;
}
topic_str, subscriptionManager, subscriptionClient );
propIndex = 0;
props[propIndex++] = clientName_a;
props[propIndex++] = NULL;
sessionMgr_p,
common_handleError ( rc, "solClient_session_endpointTopicSubscribe()" );
goto sessionConnected;
}
common_handleError ( rc, "common_publishDirectMessage()" );
goto sessionConnected;
}
printf ( "Sent.\n" );
sleepInUs ( 500 );
printf ( "Done.\n" );
sessionConnected:
common_handleError ( rc, "solClient_session_disconnect()" );
}
common_handleError ( rc, "solClient_session_disconnect()" );
}
cleanup:
common_handleError ( rc, "solClient_cleanup()" );
}
notInitialized:
return 0;
}