#include "os.h"
#include "common.h"
int flow_receiving = 1;
{
printf ( "Received message on flow. (Message ID: %lld).\n", msgId );
} else {
printf ( "Received message on flow.\n" );
}
common_handleError ( rc, "solClient_msg_dump()" );
}
if ( flow_receiving ) {
printf ( "Acknowledging message: %lld.\n", msgId );
common_handleError ( rc, "solClient_flow_sendAck()" );
}
} else {
if ( unackedMsgId ) {
printf ( "Received msgId %lld, when unacked msgId %lld already exists", msgId, unackedMsgId );
}
unackedMsgId = msgId;
}
} else {
common_handleError ( rc, "solClient_msg_getMsgId()" );
}
}
int
main ( int argc, char *argv[] )
{
struct commonOptions commandOpts;
const char *flowProps[20];
int propIndex;
char binMsg[] = COMMON_ATTACHMENT_TEXT;
int publishCount = 0;
printf ( "\nflowControlQueue.c (Copyright 2007-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_messageReceivePrintMsgCallback,
common_eventCallback, NULL, &commandOpts ) ) !=
SOLCLIENT_OK ) {
common_handleError ( rc, "common_createAndConnectSession()" );
goto cleanup;
}
propIndex = 0;
flowProps[propIndex++] = "1";
if ( commandOpts.usingDurable ) {
strncpy(queueName, COMMON_TESTQ, sizeof(COMMON_TESTQ));
} else {
"solClient_generateUUIDString() did not return SOLCLIENT_OK " "after session create. rc = %d ", rc );
goto sessionConnected;
}
}
flowProps[propIndex++] = queueName;
flowProps[propIndex] = NULL;
session_p, &flow_p, &flowFuncInfo,
sizeof ( flowFuncInfo ) ) ) !=
SOLCLIENT_OK ) {
"solClient_session_createFlow() did not return SOLCLIENT_OK " "after session create. rc = %d ", rc );
goto sessionConnected;
}
printf ( "Publishing messages to queue %s, Ctrl-C to stop.....\n", queueName );
publishCount = 0;
while ( !gotCtlC ) {
common_handleError ( rc, "solClient_msg_alloc()" );
goto cleanupFlow;
}
common_handleError ( rc, "solClient_msg_setDeliveryMode()" );
goto cleanupFlow;
}
common_handleError ( rc, "solClient_msg_setBinaryAttachmentPtr()" );
goto cleanupFlow;
}
if ( commandOpts.usingDurable ) {
destination.
dest = queueName;
} else {
common_handleError ( rc, "solClient_flow_getDestination()" );
goto sessionConnected;
}
}
common_handleError ( rc, "solClient_msg_setDestination()" );
goto cleanupFlow;
}
common_handleError ( rc, "solClient_session_send" );
goto cleanupFlow;
}
common_handleError ( rc, "solClient_msg_free()" );
goto cleanupFlow;
}
publishCount++;
if ( ( publishCount % 10 ) == 0 ) {
if ( flow_receiving ) {
flow_receiving = 0;
} else {
if ( unackedMsgId ) {
common_handleError ( rc, "solClient_flow_sendAck()" );
}
unackedMsgId = 0L;
}
flow_receiving = 1;
}
}
sleepInUs ( 500000 );
}
if ( gotCtlC ) {
printf ( "Got Ctrl-C, cleaning up\n" );
}
cleanupFlow:
common_handleError ( rc, "solClient_flow_destroy()" );
}
sessionConnected:
common_handleError ( rc, "solClient_session_disconnect()" );
}
cleanup:
common_handleError ( rc, "solClient_cleanup()" );
}
notInitialized:
return 0;
}