Author |
Message
|
suchakjani |
Posted: Fri Apr 15, 2016 7:07 am Post subject: MQPUT topicstring same as one in MQOPEN |
|
|
Newbie
Joined: 15 Apr 2016 Posts: 4
|
Hi
I have a system where i have a main topic MAIN and then many subtopics like MAIN/SUBJECT-1, MAIN/SUBJECT-2 to MAIN/SUBJECT-N .
I want to do do this(c language)
MQCONNECT
MQOPEN(open at MAIN)
MQPUT(Specific to MAIN/SUBJECT-1 etc...)
The reason is i want to have a limited set of threads reading of a table. The Table has messages and each message has exactly one specific sub topic defined within the message. Each thread would read the table and do a publish. There could be 10000's of messages.
So the limited number of threads would do a MQCONNECT and MQOPEN(open at MAIN topic) at startup. And then each thread would read the table in a loop and the do a MQPUT which would then publish to MQPUT(Specific to MAIN/SUBJECT-1 etc...) based on the message itself.
The other way to do this would be
MQCONNECT
MQPUT1(Specific to MAIN/SUBJECT-1 etc...)
So the limited number of threads would do a MQCONNECT at startup. And then each thread would read the table in a loop and the do a MQPUT1 which would then publish to MQPUT1(Specific to MAIN/SUBJECT-1 etc...) based on the message itself.
Have heard about issues of performance with MQPUT1, so do not want to do this.
However in a MQPUT I have not found a way to specify a TOPIC string to publish to.(This could just be my lack of understanding).
It will only do a put on the topic in the MQOPEN. So MQPUT can not override/concatenate the TOPIC in MQOPEN.
The issues is then i would need N threads one for each subtopic, instead of say 5 threads.
Thanks in advance! |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
mqjeff |
Posted: Fri Apr 15, 2016 7:18 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
suchakjani |
Posted: Fri Apr 15, 2016 7:32 am Post subject: |
|
|
Newbie
Joined: 15 Apr 2016 Posts: 4
|
Thanks for the reply
td.ObjectString.VSPtr = topicString;
td.ObjectString.VSLength = (MQLONG)strlen(topicString);
MQOPEN(Hconn, &td, MQOO_OUTPUT | MQOO_FAIL_IF_QUIESCING, &Hobj, &CompCode, &Reason);
You see the topic string that example is at MQOPEN level, yes ?
I want it to be at the MQPUT level, makes sense ?
The 5 threads will all do MQOPEN to MAIN topic, then on each message they will do a MQPUT at the subtopic level which could be up to 20000 or more. So i want the threads to read the message subject and then do MQPUT at MAIN/SUBJECT-20000 topicstring level .
thanks again. |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
mqjeff |
Posted: Fri Apr 15, 2016 7:37 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
suchakjani wrote: |
I want it to be at the MQPUT level, makes sense ?
|
Yes, it makes sense.
The sample doesn't work that way, and the API doesn't work that way.
Got it?
There's not a huge burden in open/close. It's a lot worse to connect/disconnect. _________________ chmod -R ugo-wx /
Last edited by mqjeff on Fri Apr 15, 2016 10:08 am; edited 1 time in total |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
suchakjani |
Posted: Fri Apr 15, 2016 7:45 am Post subject: |
|
|
Newbie
Joined: 15 Apr 2016 Posts: 4
|
Quote: |
The sample doesn't work that way, and the API doesn't work that way.
Got it? |
OK, Cool thanks, yes .
Quote: |
There's not a huge burden in open/close. It's a lot worse to connect/disconnect. |
Ok, so i guess then either i use open and put or just put1 after connect.
Just that there was this statement which said put1 not so good for high message volume.
http://www.mqseries.net/phpBB2/viewtopic.php?p=405847#405847#
Quote: |
An MQOPEN call specifying the MQOO_OUTPUT option is issued first, followed by one or more MQPUT requests to add messages to the queue; finally the queue is closed with an MQCLOSE call. This gives better performance than repeated use of the MQPUT1 call. |
|
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
mqjeff |
Posted: Fri Apr 15, 2016 7:53 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Right, so if you know you are going to send several messages to the same topic, you should use the same MQOBJ handle while you are sending those messages.
If a random thread is going to publish to a random topic each time it's called, then that's a different point.
You could also look at switching to MQTT, which does let you do this. Or even JMS. _________________ chmod -R ugo-wx / |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
suchakjani |
Posted: Fri Apr 15, 2016 7:59 am Post subject: |
|
|
Newbie
Joined: 15 Apr 2016 Posts: 4
|
Quote: |
If a random thread is going to publish to a random topic each time it's called, then that's a different point. |
Yes, it is a random thread publishing to a Topic within the hierarchy. But yes the way it looks to MQPUT is that it is a random topic each time.
Quote: |
You could also look at switching to MQTT, which does let you do this. Or even JMS. |
Will look at MQTT and JMS.
Thanks again. |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
hughson |
Posted: Tue May 03, 2016 12:51 am Post subject: |
|
|
![](images/avatars/810794940518bb946528b3.jpg) Padawan
Joined: 09 May 2013 Posts: 1914 Location: Bay of Plenty, New Zealand
|
If every thread is publishing very few messages to a random topic string that sounds very like you have meta data encoded in the topic string. You should consider making the topic string the common portion and encoding the random data as a propriety, espeically if subscribers rarely if ever subscribe to that specific random data.
Just a thought.
Cheers
Morag _________________ Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
|