Examples of Topic


Examples of javax.jms.Topic

    props.put("java.naming.factory.initial","fr.dyade.aaa.jndi2.haclient.HANamingContextFactory");
    props.put("java.naming.provider.url","hascn://localhost:16400,localhost:16410");
   
    javax.naming.Context jndiCtx = new javax.naming.InitialContext(props);
    javax.jms.TopicConnectionFactory tcf = (javax.jms.TopicConnectionFactory) jndiCtx.lookup("tcf");
    Topic topic = (Topic) jndiCtx.lookup("topic");
    jndiCtx.close();

    Connection cnx = tcf.createConnection("anonymous", "anonymous");
    Session sess = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
    MessageProducer pub = sess.createProducer(topic);
View Full Code Here

Examples of javax.jms.Topic

public class Producer {
  static Context ictx = null;

  public static void main(String[] args) throws Exception {
    ictx = new InitialContext();
    Topic topic = (Topic) ictx.lookup("sendMailTopic");
    ConnectionFactory cf = (ConnectionFactory) ictx.lookup("cf");
    ictx.close();

    Connection cnx = cf.createConnection();
    Session sess = cnx.createSession(true, 0);
View Full Code Here

Examples of javax.jms.Topic

    // Look up a JMS connection factory
    conFactory = (ConnectionFactory)jndi.lookup("factoryChat");

    // Look up a JMS topic
    Topic chatTopic = (Topic)jndi.lookup(topicName);

    // Create a JMS connection
    connection = conFactory.createConnection();

    // Create two JMS session objects
View Full Code Here

Examples of javax.jms.Topic

     */
    protected MessageConsumer createConsumer() throws JMSException {
        Session session = producer.getSession();
        if (subscriberName != null) {
            if (destination instanceof Topic) {
                Topic topic = (Topic) destination;
                return session.createDurableSubscriber(topic, subscriberName, messageSelector, noLocal);
            }
            else {
                throw new IllegalArgumentException("Cannot specify the subscriberName property when using a Queue destination");
            }
View Full Code Here

Examples of javax.jms.Topic

   public void prepare() throws JMSException {
      try {
         // create a factory (normally retreived by naming service)
         TopicConnectionFactory factory = new XBConnectionFactory(null, this.cmdLine, false);
         // should be retreived via jndi
         Topic topic = new XBDestination("jms-test", null, false);
     
         TopicConnection connection = factory.createTopicConnection();
         connection.start();
         TopicSession session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
         TopicSubscriber subscriber = session.createSubscriber(topic);
View Full Code Here

Examples of javax.jms.Topic

  
   public void testRelay() throws Exception
   {
      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
     
      Topic topic = (Topic)ic.lookup("/topic/StressTestTopic");
     
      final int numMessages = 20000;
     
      final int numRelayers = 5;
     
View Full Code Here

Examples of javax.jms.Topic

    * Test durable subscription state survives a server crash
    */
   public void testDurableSubscriptionPersistence_1() throws Exception
   {
      ServerManagement.deployTopic("YetAnotherTopic");
      Topic thisTopic = (Topic)initialContext.lookup("/topic/YetAnotherTopic");

      Connection conn = cf.createConnection();
      conn.setClientID("five");

      Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
View Full Code Here

Examples of javax.jms.Topic

   }


   public void testGetTopic() throws Exception
   {
      Topic t = ((TopicSubscriber)topicConsumer).getTopic();
      assertEquals(topic, t);
   }
View Full Code Here

Examples of javax.jms.Topic

         config = "<security><role name=\"def\" read=\"false\" write=\"false\" create=\"false\"/></security>";
         on = new ObjectName("jboss.messaging.destination:service=Topic,name=Accounting");
         ServerManagement.setAttribute(on, "SecurityConfig", config);

         Queue queue = (Queue)ic.lookup("/queue/Accounting");
         Topic topic = (Topic)ic.lookup("/topic/Accounting");

         conn = cf.createConnection("john", "needle");

         assertTrue(canReadDestination(conn, queue));
         assertFalse(canReadDestination(conn, topic));
View Full Code Here

Examples of javax.jms.Topic

    * cleaned-up.
    */
   public void testClientCrashWithTwoConnections() throws Exception
   {
      InitialContext ic = new InitialContext(InVMInitialContextFactory.getJNDIEnvironment());
      Topic topic = (Topic)ic.lookup("/topic/Topic");
     
      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
     
      CreateTwoClientOnServerCommand command = new CreateTwoClientOnServerCommand(cf, topic, true);
     
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.