Examples of TextMessage


Examples of com.sun.tck.wma.TextMessage

        Message msg = null;
        if (msgType == MessageTransportConstants.GSM_TEXT ||
            msgType == MessageTransportConstants.GSM_UCS2) {

            TextMessage textmsg = (TextMessage)
                newMessage(MessageConnection.TEXT_MESSAGE,
                           address);

            /* Always store text messages as UCS 2 bytes. */
            if (msgType == MessageTransportConstants.GSM_TEXT) {
View Full Code Here

Examples of communication.TextMessage

  @Override
  public void insert(int pos, char c) {
    System.out.println("I am going to send an insertion " + c + " at " + pos);

    /* Create the message and send it */
    TextMessage tm = new TextMessage(pos, c, TextMessage.INSERT, peerIndex, null);
    if (peerIndex != Main.rootPeer) {
      peerSender.send(tm);
      return;
    }
   
View Full Code Here

Examples of de.bamberg.ha.api.messaging.TextMessage

     
    };
   
    route1.addSuccessor(route2);
    route2.addSuccessor(route3);
    Future<DistributedExecutionResult> result=route1.processChain(new TextMessage("test"));
    assertNotNull(result);
//    assertEquals("2", result.get().getReturnValue());
  }
View Full Code Here

Examples of javax.jms.TextMessage

    * Send the given String as a JMS message to the testQueue queue.
    */
   public void send(String msg) throws JMSException {

      // Create a message
      TextMessage message = queueSession.createTextMessage();
      message.setText(msg);

      // Send the message
      queueSender.send(queue, message);
   }
View Full Code Here

Examples of javax.jms.TextMessage

    String location = System.getProperty("location");
    if (location != null)
      System.out.println("Publishes messages on topic on " + location);

    TextMessage msg = session.createTextMessage();

    int i;
    for (i = 0; i < 10; i++) {
      msg.setText("Msg " + i);
      pub.send(msg);
    }
    session.commit();

    System.out.println(i + " messages published.");
View Full Code Here

Examples of javax.jms.TextMessage

    Connection cnx = cf.createConnection("anonymous", "anonymous");
    Session sess = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
    MessageProducer pub = sess.createProducer(topic);

    TextMessage msg = sess.createTextMessage();

    int i;
    for (i = 0; i < 1000; i++) {
      msg.setText("Msg " + i);
      pub.send(msg);
      Thread.sleep(250L);
      System.out.println("publish message " + i);
    }
  }
View Full Code Here

Examples of javax.jms.TextMessage

    MessageConsumer consumer = session.createConsumer(dmq);

    cnx.start();
   
    for (int i=0; i<3; i++) {
      TextMessage msg = (TextMessage) consumer.receive();
      System.out.println("\nreceives: \"" + msg.getText() + "\", " +
                         "JMS_JORAM_ERRORCOUNT=" + msg.getIntProperty("JMS_JORAM_ERRORCOUNT"));
      System.out.println("JMS_JORAM_ERRORCAUSE_1=" + msg.getStringProperty("JMS_JORAM_ERRORCAUSE_1") + ", " +
                         "JMS_JORAM_ERRORCODE_1=" + msg.getStringProperty("JMS_JORAM_ERRORCODE_1"));
      System.out.println("JMSXDeliveryCount=" + msg.getIntProperty("JMSXDeliveryCount"));
    }

    cnx.close();
  }
View Full Code Here

Examples of javax.jms.TextMessage

      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

Examples of javax.jms.TextMessage

    cnx.start();

    // Producing messages with a very short time to live: 20 ms.
    System.out.println("Sends Message1 with a very short time to live");
    TextMessage msg = prodSession.createTextMessage("Message1");
    producer.send(queue1, msg, DeliveryMode.NON_PERSISTENT, Message.DEFAULT_PRIORITY, 20);
   
    // Waiting for the message to be expired.
    System.out.println("Waits for the message to be expired");
    Thread.sleep(100);

    msg = (TextMessage) consumer.receiveNoWait();
    System.out.println("receives: " + msg);
   
    // Producing "undeliverable" messages
    System.out.println("Send Message2");  
    msg = prodSession.createTextMessage("Message2");
    producer.send(queue1, msg);
   
    msg = (TextMessage) consumer.receive();
    System.out.println("Receives: " + msg.getText() + " then deny it!");
    consSession.rollback();
   
    msg = (TextMessage) consumer.receive();
    System.out.println("Receives: " + msg.getText() + " then deny it!");
    consSession.rollback();
       
    // Producing "forbidden" messages
    System.out.println("Send Message3");  
    msg = prodSession.createTextMessage("Message3");
View Full Code Here

Examples of javax.jms.TextMessage

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

    TextMessage msg = sess.createTextMessage();

    int i;
    for (i = 0; i < 5000; i++) {
      msg.setText("Msg " + i);
      pub.send(msg);
      Thread.sleep(250L);
      System.out.println("publish message " + i);
    }
  }
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.