ibm mq - Connecting IBM MQ queue using F5 virtual ip and C++ -
i trying connect ibm mq queues using c++. these queues have been defined under different manager queues in different servers. idea connect vip balance workload pointing each server.
the problem have using cmqc.h
libraries, , in order connect have make use of mqconn
or mqconnx
, need queue manager name, cannot know @ moment of connection don´t know 1 used due f5 balancer.
the code using example following:
#include <cmqc.h> #include <cmqxc.h> #include <string.h> #include <stdio.h> #include <sstream> #include <stdlib.h> int main() { mqhconn connectionhandle; mqhobj m_sourcequeue; mqlong completioncode = 0; mqlong reasoncode = 0; setenv("mqserver","system.def.svrconn/tcp/<server_ip_address>(56245)",1); mqconn(<queue_manager_name>, &connectionhandle, &completioncode, &reasoncode); if(mqcc_ok != completioncode) { printf ("%s \n", "error"); printf ("%s %d \n", "completion code", completioncode); printf ("%s %d \n", "reason code", reasoncode); } mqdisc(&connectionhandle, &completioncode, &reasoncode); }
does have idea how connect queue when queue manager name not available?
based on code provide can use null
, or blanks, or *
instead of queue manager name.
for example:
mqconn("", &connectionhandle, &completioncode, &reasoncode); mqconn(" ", &connectionhandle, &completioncode, &reasoncode); mqconn("*", &connectionhandle, &completioncode, &reasoncode);
any of above connect queue manager listening on host , port specify in mqserver
environment variable.
mqconn
documented in ibm mq knowledge center page mqconn - connect queue manager. quoting few things related queue manager name page:
if name consists entirely of blanks, the name of default queue manager used.
in case of mqserver
default queue manager 1 listening on host , port connected to.
the page has following in context of ccdt works same mqserver
:
if all-blank name specified, each client-connection channel all-blank queue-manager name tried until 1 successful; in case there no check against actual name of queue manager.
prefixing asterisk connection name implies application not depend on connecting particular queue manager in group. suitable applications are:
- applications put messages not messages.
- applications put request messages , reply messages temporary dynamic queue.
unsuitable applications ones need messages particular queue @ particular queue manager; such applications must not prefix name asterisk.
i suggest instead use ccdt (client channel definition table) provides more flexibility. mqserver
can provide host, port, , channel name. ccdt allow configure many more options, example tls, security exits, max message length name few.
Comments
Post a Comment