4 Replies Latest reply: Jul 28, 2011 10:38 AM by murgir_jhol RSS

    Query regarding publishing to a topic in Sun MQ 4.4

    murgir_jhol
      Hi,
      I am absolutely new to Sun MQ.Last day I was trying to publish to a topic using the follwing java code:-


      ConnectionFactory myFctry=new ConnectionFactory();
      myFctry.setProperty(ConnectionConfiguration.imqAddressList, "localhost:7676");
      myFctry.setProperty(ConnectionConfiguration.imqReconnectEnabled,"true");
      Connection myConnection=myFctry.createConnection();
      javax.jms.Session mySession= myConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
      Destination myDest=mySession.createTopic("myTestTopic");
      MessageProducer myProducer=mySession.createProducer(myDest);
      System.out.println(myProducer.getDestination());
      TextMessage outMsg=mySession.createTextMessage();
      outMsg.setText("yahoooo again!!!!");
      myProducer.send(outMsg);
      mySession.close();
      myConnection.close();
      System.out.println("message published");


      Although this piece of code is working for a queue(I just replaced the destination with Destination myDest=mySession.createQueue("myTestTopic")).But the above code is not working for a topic.I've been stuck here fro long.Please help.

      Thanks in advance