#include "os.h"
#include "common.h"
static void
{
char payload[] = COMMON_ATTACHMENT_TEXT;
common_handleError ( rc, "solClient_msg_alloc()" );
return;
}
common_handleError ( rc, "solClient_msg_setDeliveryMode()" );
return;
}
destination.
dest = destinationNameStr_p;
common_handleError ( rc, "solClient_msg_setDestination()" );
goto freeMsg;
}
common_handleError ( rc, "solClient_msg_createUserPropertyMap()" );
goto freeMsg;
}
common_handleError ( rc, "solClient_container_addString()" );
goto freeMsg;
}
common_handleError ( rc, "solClient_container_closeMapStream()" );
goto freeMsg;
}
common_handleError ( rc, "solClient_msg_setBinaryAttachment()" );
goto freeMsg;
}
common_handleError ( rc, "solClient_session_sendMsg()" );
}
freeMsg:
common_handleError ( rc, "solClient_msg_free()" );
}
}
int
main ( int argc, char *argv[] )
{
struct commonOptions commandOpts;
const char *flowProps[20];
int propIndex;
printf ( "\nmessageSelectorsOnQueue.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_messageReceiveCallback,
common_eventCallback, NULL, &commandOpts ) ) !=
SOLCLIENT_OK ) {
common_handleError ( rc, "common_createAndConnectSession()" );
goto cleanup;
}
propIndex = 0;
flowProps[propIndex++] = "pasta='rotini' OR pasta='farfalle'";
flowProps[propIndex++] = NULL;
session_p, &flow_p, &flowFuncInfo,
sizeof ( flowFuncInfo ) ) ) !=
SOLCLIENT_OK ) {
"solClient_session_createFlow() did not return SOLCLIENT_OK after session connect. rc = %d ", rc );
goto sessionConnected;
}
printf (
"Created Flow to receive messages sent to %s\n", flowDest.
dest );
} else {
common_handleError ( rc, "Unable to retrieve Flow Destination" );
}
printf ( "Waiting for messages.....Expecting two messages to match the selector" );
pubMsg ( session_p, flowDest.
dest,
"macaroni" );
pubMsg ( session_p, flowDest.
dest,
"fettuccini" );
pubMsg ( session_p, flowDest.
dest,
"farfalle" );
pubMsg ( session_p, flowDest.
dest,
"fiori" );
pubMsg ( session_p, flowDest.
dest,
"rotini" );
pubMsg ( session_p, flowDest.
dest,
"penne" );
sleepInSec ( 5 );
sessionConnected:
if ( flow_p != NULL ) {
common_handleError ( rc, "solClient_flow_destroy()" );
}
}
common_handleError ( rc, "solClient_session_disconnect()" );
}
cleanup:
common_handleError ( rc, "solClient_cleanup()" );
}
goto notInitialized;
notInitialized:
return 0;
}