Package org.objectweb.joram.client.connector

Examples of org.objectweb.joram.client.connector.JoramAdapter


      JWorkManager jw = new JWorkManager(1,4,5000);
      ResourceBootstrapContext bt=new ResourceBootstrapContext(jw);


      System.out.println("JoramAdapter ...");
      JoramAdapter ja= new JoramAdapter() ;
     
      ja.start(bt);
      System.out.println("start ...");
    
      Context ictx = new InitialContext();
      Queue queue = (Queue) ictx.lookup("queue");
      Topic topic = (Topic) ictx.lookup("topic");
    
      ictx.close();

      ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
      mcf.setResourceAdapter(ja);
      System.out.println("ManagedConnectionFactoryImpl ok");
    
      ManagedConnectionImpl mci = (ManagedConnectionImpl) mcf.createManagedConnection(null,null);
      System.out.println("ManagedConnectionImpl ok");

      OutboundConnection oc = (OutboundConnection) mci.getConnection(null,null);
      System.out.println("OutboundConnection ok");
     
      final OutboundSession os =(OutboundSession) oc.createSession(false,1);
      System.out.println("OutboundSession ok");
    
      final OutboundProducer prod = (OutboundProducer) os.createProducer(queue);
      final OutboundProducer prod1 = (OutboundProducer) os.createProducer(topic);

      System.out.println("OutboundProducer ok");

      OutboundConsumer cons = (OutboundConsumer) os.createConsumer(queue);
      OutboundConsumer cons1 = (OutboundConsumer) os.createConsumer(topic)
      System.out.println("OutboundConsumer ok");

      oc.start();
      System.out.println();
      System.out.println("Without MessageListener");
      TextMessage msg = os.createTextMessage("avec queue");
      prod.send(msg);
      TextMessage msg1 =(TextMessagecons.receive();
      System.out.println("msg receive :"+msg1.getText());
      System.out.println();

      System.out.println("With MessageListener");
      MessagePointFactory  mep = new MessagePointFactory();
      ActivationSpecImpl spec = new ActivationSpecImpl();
      spec.setResourceAdapter(ja);
      spec.setDestinationType("javax.jms.Queue");
      spec.setDestination("queue");

      MessagePointFactory mep2 = new MessagePointFactory();
      ActivationSpecImpl spec2 = new ActivationSpecImpl();
      spec2.setResourceAdapter(ja);
      spec2.setDestinationType("javax.jms.Topic");
      spec2.setDestination("topic");
     
     
      ja.endpointActivation(mep , spec); // listener on queue
      ja.endpointActivation(mep2 , spec2);// listener on topic
    
     
      System.out.println("new thread producer on queue");
      new Thread() {
    public void run() {
        int i = 0;
        try {
      while(i!=100){
                          i++;
                          TextMessage msg = os.createTextMessage("with queue "+i);
                          prod.send(msg);
      }
        } catch (Exception exc) {
     
        }
    }
      }.start();
      System.out.println("new thread producer on topic");
      new Thread() {
    public void run() {
        int i = 0;
        try {
      while(i!=100){
          i++;
          TextMessage msg = os.createTextMessage("with topic2 "+i);
          prod1.send(msg);
      }
        } catch (Exception exc) {
     
        }
    }
      }.start();
       
 
      System.out.println("wait receive, press a key to exit");
      System.in.read();
     
      ja.stop();
      System.out.println("stop");
      System.exit(0);

  }
View Full Code Here


        }

        BootstrapContext bootstrapContext = new JoramBootstrapContext(this.workManager, xaTerminator);

        // Create JORAM adapter
        this.joramAdapter = new JoramAdapter();

        // Set host/port
        this.joramAdapter.setHostName(this.host);
        this.joramAdapter.setServerPort(Integer.valueOf(this.port));
View Full Code Here

TOP

Related Classes of org.objectweb.joram.client.connector.JoramAdapter

Copyright © 2018 www.massapicom. 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.