generating Destinatios programatically

Hi ,Can I create destinatios run time. If yes , is it temperory or permanant.If any one knows how to do it . Please share it Regards,Anjali
[188 byte] By [Anjali_c] at [2007-9-26 1:29:32]
# 1

Yes you can but the methods are not part of the JMS spec - they are vendor specific. The code below is an example of how to create a topic for Oracle AQ. As to whether it is temperory or permanant is dependant on your code.

You can, of course, create durable subscritpions to topics at runtime through JMS.

R.

KMS

public void createTopic(String topicName) throws AQException{

AQQueueTableProperty qtable_prop;

AQQueueProperty queue_prop;

AQQueueTable q_table;

AQQueue queue;

AQAgent subs1, subs2;

try{

// Get session

if(aq_sess == null)

aq_sess = createSession();

// Create a AQQueueTable property object (payload type - TEXT):

qtable_prop = new AQQueueTableProperty("SYS.AQ$_JMS_TEXT_MESSAGE");

// Set multiconsumer flag to true:

qtable_prop.setMultiConsumer(true);

// Create a queue table called <topicName> in <username> schema: */

q_table = aq_sess.createQueueTable (username,topicName, qtable_prop);

// Create a new AQQueueProperty object:

queue_prop = new AQQueueProperty();

// Create a topic called <topicName>

queue = aq_sess.createQueue (q_table, topicName, queue_prop);

// Enable enqueue/dequeue on this queue:

queue.start();

System.out.println("Successful queue start");

}catch(AQException ex){

aq_sess = null;

ex.printStackTrace();

throw ex;

}finally{

aq_sess = null;

}

}

kevinms at 2007-6-29 1:26:16 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

weblogic.jms.extensions.JMSHelper.createPermanentTopicAsync(Context ctx,String server ,StringtopicName,String jndiName);

ctx = the JNDI Context object

server = the name of JMS server which u create through the weblogic admin console

topicname= the name of the topic which u want ot create

jndiname=the jndi name of that topic

using this jndiname of the topic we use it.

the above JMS implementation assumes that you are using Weblogic 6.0 server

ref:gchandrasekhar@indiatimes.com

gchandrasekhar at 2007-6-29 1:26:16 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...