#include "os.h"
#include "common.h"
{
void *binaryAttachmentBuffer_p;
solClient_uint32_t binaryAttachmentBufferSize;
common_handleError ( rc, "solClient_msg_getDestination()" );
}
&binaryAttachmentBuffer_p,
common_handleError ( rc, "solClient_msg_getBinaryAttachmentPtr()" );
}
printf ( "*** Event Message Received ***\n" );
printf (
"Topic:\t%s\n", destination.
dest );
printf ( "Event:\t%s\n", ( char * ) binaryAttachmentBuffer_p );
}
{
if ( ( rc = common_createAndConnectSession ( context_p,
&session_p,
common_messageReceivePrintMsgCallback,
common_eventCallback, NULL, commandOpts ) ) !=
SOLCLIENT_OK ) {
common_handleError ( rc, "common_createAndConnectSession()" );
return rc;
}
common_handleError ( rc, "solClient_session_topicSubscribe()" );
}
common_handleError ( rc, "solClient_session_disconnect()" );
}
return rc;
}
int
main ( int argc, char *argv[] )
{
struct commonOptions commandOpts;
char *eventTopicFormat = "#LOG/INFO/CLIENT/%s/CLIENT_CLIENT_CONNECT/>";
printf ( "\neventMonitor.c (Copyright 2009-2024 Solace Corporation. All rights reserved.)\n" );
initSigHandler ( );
common_initCommandOptions(&commandOpts,
( USER_PARAM_MASK ),
( HOST_PARAM_MASK |
PASS_PARAM_MASK |
NUM_MSGS_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,
&session_p,
messageReceiveEventMonitorCallback,
common_eventCallback, NULL, &commandOpts ) ) !=
SOLCLIENT_OK ) {
common_handleError ( rc, "common_createAndConnectSession()" );
goto cleanup;
}
common_handleError ( rc, "solClient_session_getCapability()" );
goto sessionConnected;
}
snprintf ( eventTopic,
sizeof ( eventTopic ), eventTopicFormat, routerName.
value.
string );
common_handleError ( rc, "solClient_session_topicSubscribe()" );
goto sessionConnected;
}
if ( ( rc = triggerSecondaryConnection ( context_p, &commandOpts ) ) !=
SOLCLIENT_OK ) {
common_handleError ( rc, "triggerSecondaryConnection()" );
goto sessionConnected;
}
sleepInSec ( 1 );
printf ( "Cleaning up.\n" );
sessionConnected:
common_handleError ( rc, "solClient_session_disconnect()" );
}
cleanup:
common_handleError ( rc, "solClient_cleanup()" );
}
notInitialized:
return 0;
}