ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum IndexIBM MQ API SupportMQPUT topicstring same as one in MQOPEN

Post new topicReply to topic
MQPUT topicstring same as one in MQOPEN View previous topic :: View next topic
Author Message
suchakjani
PostPosted: Fri Apr 15, 2016 7:07 am Post subject: MQPUT topicstring same as one in MQOPEN Reply with quote

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
View user's profile Send private message
mqjeff
PostPosted: Fri Apr 15, 2016 7:18 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17258

http://www.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.dev.doc/q026580_.htm?lang=en
_________________
Read, Think, Try, Repeat
Back to top
View user's profile Send private message
suchakjani
PostPosted: Fri Apr 15, 2016 7:32 am Post subject: Reply with quote

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
View user's profile Send private message
mqjeff
PostPosted: Fri Apr 15, 2016 7:37 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17258

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.
_________________
Read, Think, Try, Repeat


Last edited by mqjeff on Fri Apr 15, 2016 10:08 am; edited 1 time in total
Back to top
View user's profile Send private message
suchakjani
PostPosted: Fri Apr 15, 2016 7:45 am Post subject: Reply with quote

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
View user's profile Send private message
mqjeff
PostPosted: Fri Apr 15, 2016 7:53 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17258

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.
_________________
Read, Think, Try, Repeat
Back to top
View user's profile Send private message
suchakjani
PostPosted: Fri Apr 15, 2016 7:59 am Post subject: Reply with quote

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
View user's profile Send private message
hughson
PostPosted: Tue May 03, 2016 12:51 am Post subject: Reply with quote

Yatiri

Joined: 09 May 2013
Posts: 680
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
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexIBM MQ API SupportMQPUT topicstring same as one in MQOPEN
Jump to:



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP


Theme by Dustin Baccetti
Powered by phpBB 2001, 2002 phpBB Group

Copyright MQSeries.net. All rights reserved.