#include "os.h"
#include "common.h"
int
main ( int argc, char *argv[] )
{
struct commonOptions commandOpts;
char *user_p = "Session Callback";
const char *props[40];
int propIndex;
char *topic_p[2] = { COMMON_MY_SAMPLE_TOPIC "/1",
COMMON_MY_SAMPLE_TOPIC "/2"
};
printf ( "\ntopicToQueueMapping.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,
&session_p,
common_messageReceiveCallback,
common_eventCallback, user_p, &commandOpts ) ) !=
SOLCLIENT_OK ) {
common_handleError ( rc, "common_createAndConnectSession()" );
goto cleanup;
}
goto sessionConnected;
}
if ( ( rc = common_createQueue ( session_p, COMMON_TESTQ ) ) !=
SOLCLIENT_OK ) {
common_handleError ( rc, "common_createQueue()" );
goto sessionConnected;
}
propIndex = 0;
props[propIndex++] = COMMON_TESTQ;
props[propIndex++] = NULL;
session_p,
common_handleError ( rc, "solClient_session_endpointTopicSubscribe()" );
goto sessionConnected;
}
propIndex = 0;
props[propIndex++] = COMMON_TESTQ;
props[propIndex] = NULL;
session_p, &flow_p, &flowFuncInfo,
sizeof ( flowFuncInfo ) ) ) !=
SOLCLIENT_OK ) {
common_handleError ( rc, "solClient_session_createFlow() did not return SOLCLIENT_OK" );
goto sessionConnected;
}
topic_p[1],
NULL,
0
common_handleError ( rc, "solClient_flow_topicSubscribeWithDispatch()" );
goto sessionConnected;
}
printf ( "Publishing two messages, expect two messages received on flow\n\n" );
sleepInSec ( 1 );
sessionConnected:
if ( flow_p != NULL ) {
common_handleError ( rc, "solClient_flow_destroy()" );
}
}
if ( ( rc = common_deleteQueue ( session_p, COMMON_TESTQ ) ) !=
SOLCLIENT_OK ) {
common_handleError ( rc, "common_deleteQueue()" );
}
common_handleError ( rc, "solClient_session_disconnect()" );
}
cleanup:
common_handleError ( rc, "solClient_cleanup()" );
}
notInitialized:
return 0;
}