Author |
Message
|
dwitherspoon |
Posted: Wed Aug 04, 2004 12:49 pm Post subject: Creating a dynamic queue with a fixed name |
|
|
 Acolyte
Joined: 09 Dec 2003 Posts: 59
|
I have successfully created a dynamic queue with code like this:
Code: |
queueConnFactory.setTemporaryModel("MODEL.QUEUE");
queueConnFactory.setTempQPrefix("BLAH.DYNQUE.*");
session.createTemporaryQueue(); |
This results in a queue name like BLAH.DYNQUE.412923984329872.
What I really want to do is create a dynamic queue without a unique identifier generated into the name. So, I'd like to call
Code: |
queueConnFactory.setTempQPrefix("BLAH.DYNQUE.ACME"); |
and have the queue name be what I specified. But when I leave out the "*", I get an exception. Now the javadoc says that an exception is thrown if the prefix is null, empty, longer than 33 chars, or consists solely of a single asterisk.
Am I doing something wrong? Can I not do this? I read somewhere in an IBM doc (can't put my finger on it now) that you can create a dynamic queue with either a fixed name or a name that gets "uniqified". But I can't seem to do the former.
Help? _________________ Good...Fast...Cheap. Choose any two. |
|
Back to top |
|
 |
bower5932 |
Posted: Wed Aug 04, 2004 1:11 pm Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
With the JMS, you are allowed to specify a TEMPQPREFIX which is the prefix that gets put on the temporary queue name.
With regular WMQ, you can specify either a prefix or the queue name. The info that you read was probably in the MQOD description of the Application Programming Reference. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Aug 04, 2004 2:44 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
I don't quite understand what you are trying to achieve.
Creation of a temp queue in JMS means you have no way of knowing what the queue name is until the object is returned to you.
If you want to access a queue but you'll only know its name at runtime, try using
Code: |
Session.createQueue(String queuename) |
This will allow you to access an existing queue the name of which is being determined at runtime. It will not need to be defined in JNDI.
Some of the characteristics might need to get set by casting it to MQQueue.
Enjoy
F.J. |
|
Back to top |
|
 |
bower5932 |
Posted: Thu Aug 05, 2004 5:46 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
I should probably let dwitherspoon answer for himself, but I'm guessing that he wants to dynamically create some queues and he wants them to have a specific name (as opposed to just a prefix on the name). He might be looking at reducing some of the administration that needs to be done on his system. |
|
Back to top |
|
 |
dwitherspoon |
Posted: Thu Aug 12, 2004 3:53 am Post subject: |
|
|
 Acolyte
Joined: 09 Dec 2003 Posts: 59
|
Exactly so. _________________ Good...Fast...Cheap. Choose any two. |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Aug 12, 2004 1:21 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Explore autodefinition and check if the session.createQueue will work for creating the missing queue.
The right way would be to build your pcf commands and issue them right there. You would need to look for the java / pcf support pack.
Finally the quick and dirty
Quick fix no java / pcf support pack
a) you create a message with the exact syntax for runmqsc.
b) you place it all on a queue ("command" queue)
c) you place a dummy message on a triggered queue
d) you run a process.
1) it removes the message from the triggered queue
2) it reads the messages from the "command" queue and dumps them into your "command file"
3) it starts runmqsc and processes your script ("command file")
Now you have your queues and the name is permanent.
If you need to delete them at the end of the session use 2 "command" queues. Put one message on each (define / delete).
Run the delete process only at the end.
I used the sample programs (c) and some interesting scripting (unix) to execute a few commands this way (runmqsc).
The right way would be to build your pcf commands and issue them right there. You would need to look for the java / pcf support pack.
Enjoy. |
|
Back to top |
|
 |
dwitherspoon |
Posted: Fri Aug 13, 2004 3:30 am Post subject: |
|
|
 Acolyte
Joined: 09 Dec 2003 Posts: 59
|
Thanks for the info...I'll look into the PCF approach. Is this something that can be done from Java? _________________ Good...Fast...Cheap. Choose any two. |
|
Back to top |
|
 |
bower5932 |
Posted: Fri Aug 13, 2004 5:30 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
In order to do PCFs from java, you'll need to get SupporPac MS0B. |
|
Back to top |
|
 |
|