Package org.objectweb.joram.client.connector

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


      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) {
     
        }
View Full Code Here

TOP

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

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.