#include "os.h"
#include "common.h"
int
main ( int argc, char *argv[] )
{
struct commonOptions commandOpts;
int msgsSent = 0;
char messageField[32];
printf ( "\nsdtPubSubMsgDep.c (Copyright 2009-2024 Solace Corporation. All rights reserved.)\n" );
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_messageReceivePrintMsgCallback,
common_eventCallback, NULL, &commandOpts ) ) !=
SOLCLIENT_OK ) {
common_handleError ( rc, "common_createAndConnectSession()" );
goto cleanup;
}
common_handleError ( rc, "solClient_session_topicSubscribe()" );
goto sessionConnected;
}
common_handleError ( rc, "solClient_msg_alloc()" );
goto sessionConnected;
}
common_handleError ( rc, "solClient_msg_setDeliveryMode()" );
goto freeMessage;
}
destination.
dest = COMMON_MY_SAMPLE_TOPIC;
common_handleError ( rc, "solClient_msg_setDestination()" );
goto freeMessage;
}
common_handleError ( rc, "solClient_msg_createBinaryAttachmentStream()" );
goto freeMessage;
}
common_handleError ( rc, "solClient_container_addDouble()" );
goto freeMessage;
}
common_handleError ( rc, "solClient_container_addString()" );
goto freeMessage;
}
common_handleError ( rc, "solClient_msg_createUserPropertyMap()" );
goto freeMessage;
}
common_handleError ( rc, "solClient_container_addInt32()" );
goto freeMessage;
}
for ( msgsSent = 0; msgsSent < 10; ++msgsSent ) {
common_handleError ( rc, "solClient_container_deleteField()" );
goto freeMessage;
}
snprintf ( messageField, 32, "message%d", ( msgsSent + 1 ) );
common_handleError ( rc, "solClient_container_addString()" );
goto freeMessage;
}
common_handleError ( rc, "solClient_session_sendMsg()" );
goto freeMessage;
}
}
freeMessage:
common_handleError ( rc, "solClient_msg_free()" );
goto sessionConnected;
}
sleepInSec ( 1 );
common_handleError ( rc, "solClient_session_topicSubscribe()" );
goto sessionConnected;
}
sessionConnected:
common_handleError ( rc, "solClient_session_disconnect()" );
}
cleanup:
common_handleError ( rc, "solClient_cleanup()" );
}
notInitialized:
return 0;
}