#include "os.h"
#include "common.h"
{
printf ( "Received message on flow. (Message ID: %llu).\n", msgId );
} else {
printf ( "Received message on flow.\n" );
}
}
{
char binMsg[1024];
common_handleError ( rc, "solClient_msg_alloc()" );
}
common_handleError ( rc, "solClient_msg_setDeliveryMode()" );
}
memset ( ( void * ) binMsg, 0xab, sizeof ( binMsg ) );
common_handleError ( rc, "solClient_msg_setBinaryAttachmentPtr()" );
}
common_handleError ( rc, "solClient_msg_setDestination()" );
}
common_handleError ( rc, "solClient_session_send" );
}
common_handleError ( rc, "solClient_msg_free()" );
}
}
int
main ( int argc, char *argv[] )
{
struct commonOptions commandOpts;
const char *provProps[20];
int provIndex = 0;
char provQueueName[80];
int propIndex = 0;
const char *flowProps[20];
printf ( "\nqueueProvision.c (Copyright 2009-2024 Solace Corporation. All rights reserved.)\n" );
initSigHandler ( );
common_initCommandOptions(&commandOpts,
( USER_PARAM_MASK ),
( HOST_PARAM_MASK |
PASS_PARAM_MASK |
DURABLE_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, NULL, &commandOpts ) ) !=
SOLCLIENT_OK ) {
common_handleError ( rc, "common_createAndConnectSession()" );
goto cleanup;
}
printf ( "Checking for capability SOLCLIENT_SESSION_CAPABILITY_ENDPOINT_MANAGEMENT..." );
goto sessionConnected;
}
printf ( "OK\n" );
if (commandOpts.usingDurable) {
snprintf ( provQueueName, sizeof ( provQueueName ), "sample_queue_Provision_%llu", usTime % 100000 );
printf ( "Provisioning durable queue '%s' ...", provQueueName );
provIndex = 0;
provProps[provIndex++] = provQueueName;
provProps[provIndex++] = "100";
provProps[provIndex++] = "500000";
provProps[provIndex++] = "15";
provProps[provIndex++] = NULL;
session_p,
if ( errorInfo_p != NULL ) {
"solClient_session_endpointProvision() failed subCode (%d:'%s')",
} else {
"solClient_session_endpointProvision() failed subCode (%d:'%s')",
}
goto sessionConnected;
}
} else {
endpointProvisioned = TRUE;
printf ( "OK\n" );
}
}
propIndex = 0;
if (commandOpts.usingDurable) {
}
else {
"solClient_generateUUIDString() did not return SOLCLIENT_OK " "after session create. rc = %d ", rc );
goto sessionConnected;
}
flowProps[propIndex++] = "100";
flowProps[propIndex++] = "500000";
flowProps[propIndex++] = "15";
}
flowProps[propIndex++] = provQueueName;
flowProps[propIndex++] = NULL;
printf ( "Creating flow..." );
session_p,
&flow_p, &flowFuncInfo,
sizeof ( flowFuncInfo ) ) ) !=
SOLCLIENT_OK ) {
common_handleError ( rc, "solClient_session_createFlow() did not return SOLCLIENT_OK." );
goto sessionConnected;
}
printf ( "OK.\n" );
printf ( "Sending and Receiving, Ctrl-C to stop...\n" );
common_handleError ( rc, "solClient_flow_getDestination()" );
goto sessionConnected;
}
while ( !gotCtlC ) {
if ( ( rc = sendQueueMessage ( destination, session_p ) ) !=
SOLCLIENT_OK ) {
sleepInSec ( 1 );
break;
}
sleepInSec ( 1 );
}
printf ( "Got Ctrl-C, cleaning up.\n" );
sessionConnected:
if ( endpointProvisioned ) {
printf ( "Destroying flow.\n" );
printf ( "Deprovisioning queue.\n" );
session_p,
if ( errorInfo_p != NULL ) {
"solClient_session_endpointDeprovision() failed subCode (%d:'%s')",
}
}
}
common_handleError ( rc, "solClient_session_disconnect()" );
}
cleanup:
common_handleError ( rc, "solClient_cleanup()" );
}
notInitialized:
return 0;
}