Examples of TextMessage


Examples of javax.jms.TextMessage

      MessageConsumer ds = s.createDurableSubscriber(thisTopic, "sub", null, false);

      MessageProducer p = s.createProducer(thisTopic);
      p.setDeliveryMode(DeliveryMode.PERSISTENT);
      TextMessage tm = s.createTextMessage("thebody");
      p.send(tm);
      log.debug("message sent");

      conn.close();

      log.debug("stopping the server");
      ServerManagement.stopServerPeer();

      try
      {
         initialContext.lookup("/topic/YetAnotherTopic");
         fail("this should throw exception");
      }
      catch(NameNotFoundException e)
      {
         // OK
      }

      log.debug("starting the server");
      ServerManagement.startServerPeer();
      log.debug("server started");

      // Messaging server restart implies new ConnectionFactory lookup
      cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory");

      ServerManagement.deployTopic("YetAnotherTopic");
      log.debug("topic deployed");

      thisTopic = (Topic)initialContext.lookup("/topic/YetAnotherTopic");

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

      s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      conn.start();

      ds = s.createDurableSubscriber(thisTopic, "sub", null, false);

      TextMessage rm = (TextMessage)ds.receive(3000);
      assertNotNull(rm);
      assertEquals("thebody", rm.getText());


      conn.close();
      ServerManagement.undeployTopic("YetAnotherTopic");
   }
View Full Code Here

Examples of javax.jms.TextMessage

      MessageProducer prod = sessSend.createProducer(topic);
      prod.setDeliveryMode(DeliveryMode.PERSISTENT);
     
      for (int i = 0; i < 10; i++)
      {
         TextMessage tm = sessSend.createTextMessage("message" + i);
         prod.send(tm);
      }
     
      conn.close();
     
      ServerManagement.stopServerPeer();

      ServerManagement.startServerPeer();

      // Messaging server restart implies new ConnectionFactory lookup
      cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory");

      ServerManagement.deployTopic("Topic");
     
      conn = cf.createConnection();
      conn.setClientID("Sausages");
     
      sessConsume = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      conn.start();
     
      sub1 = sessConsume.createDurableSubscriber(topic, "sub1", null, false);
      sub2 = sessConsume.createDurableSubscriber(topic, "sub2", null, false);
      sub3 = sessConsume.createDurableSubscriber(topic, "sub3", null, false);
                 
      for (int i = 0; i < 10; i++)
      {
         TextMessage tm1 = (TextMessage)sub1.receive(3000);
         assertNotNull(tm1);
         if (tm1 == null)
         {
            break;
         }
         assertEquals("message" + i, tm1.getText());
        
         TextMessage tm2 = (TextMessage)sub2.receive(3000);
         assertNotNull(tm2);
         if (tm2 == null)
         {
            break;
         }
         assertEquals("message" + i, tm2.getText());
        
         TextMessage tm3 = (TextMessage)sub3.receive(3000);
         assertNotNull(tm3);
         if (tm3 == null)
         {
            break;
         }
         assertEquals("message" + i, tm3.getText());
      }
     
    
      conn.close();
   }
View Full Code Here

Examples of javax.jms.TextMessage

         Connection conn = cf.createConnection();
         conn.start();
         Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
         MessageConsumer cons = sess.createConsumer(queue);
         TextMessage tm = (TextMessage)cons.receive(5000);

         assertNotNull(tm);
         assertEquals(MESSAGE_TEXT, tm.getText());

         // the client VM should exit by itself. If it doesn't, that means we have a problem
         // and the test will timeout
         log.info("waiting for the client VM to exit ...");
         p.waitFor();
View Full Code Here

Examples of javax.jms.TextMessage

      Enumeration en = browser.getEnumeration();

      assertTrue(en.hasMoreElements());

      TextMessage rm = (TextMessage)en.nextElement();

      assertNotNull(rm);
      assertEquals("A", rm.getText());

      assertFalse(en.hasMoreElements());

      // create a *new* enumeration, that should reset it

      en = browser.getEnumeration();

      assertTrue(en.hasMoreElements());

      rm = (TextMessage)en.nextElement();

      assertNotNull(rm);
      assertEquals("A", rm.getText());

      assertFalse(en.hasMoreElements());
   }
View Full Code Here

Examples of javax.wireless.messaging.TextMessage

    /**
     * @see ReceiveListenerRegistry#fireAll()
     */
    public void fireAll() {
        while( !messages.isEmpty() ) {
            final TextMessage msg = (TextMessage) messages.elementAt( 0 );
            uiApplication.invokeLater( new Runnable() {
                public void run() {
                    new callbackDispatchThread( msg ).start();
                }
            } );
View Full Code Here

Examples of net.glowstone.util.TextMessage

import java.io.IOException;

public final class ChatCodec implements Codec<ChatMessage> {
    @Override
    public ChatMessage decode(ByteBuf buf) throws IOException {
        TextMessage message = GlowBufUtils.readChat(buf);
        int mode = buf.readByte();
        return new ChatMessage(message, mode);
    }
View Full Code Here

Examples of org.apache.wicket.protocol.ws.api.message.TextMessage


  @Override
  public void onMessage(final String message)
  {
    broadcastMessage(new TextMessage(message));
  }
View Full Code Here

Examples of org.goldenorb.types.message.TextMessage

    CountDownLatch startLatch = new CountDownLatch(1);
    CountDownLatch everyoneDoneLatch = new CountDownLatch(numberOfPartitions);
    for (int i = 0; i < numberOfPartitions; i++) {
      Messages msgs = new Messages(TextMessage.class);
      for (int p = 0; p < numOfMessagesToSendPerThread; p++) {
        TextMessage txtmsg = new TextMessage(Integer.toString(i), new Text("test message "
                                                                           + Integer.toString(p)));
        msgs.add(txtmsg);
      }
     
      OutboundMessageThread obmThread = new OutboundMessageThread(msgs, omq, startLatch, everyoneDoneLatch);
View Full Code Here

Examples of org.sis.ancmessaging.server.domain.TextMessage

            int smscCode = Integer.parseInt(message.getRefNo());
            String recipient = "+" + message.getRecipient();
           
            mainForm.setLogText("\n\nIncoming status Report ...");

            TextMessage textMessage = textMessageDao.getBySmscCodeAndRecipient(smscCode, recipient);
            if (textMessage != null) {
                Mother mother = motherDao.getMother(textMessage.getSeqId());
                String reminderType = textMessage.getMessageType();
                boolean reminderAlreadySent;
                if (reminderType.equals("MONTHLY")) {
                    reminderAlreadySent = motherDao.hasMonthlyReminder(mother);
                } else {
                    reminderAlreadySent = motherDao.hasWeeklyReminder(mother);
                }

                if (!reminderAlreadySent) {
                    textMessageDao.changeStatus(textMessage, "A");
                    mainForm.setLogText("\nReminder to be written to database ...");
                    DateTime eddGreg = new DateTime(mother.getEdd());
                    LocalDate eddEth = eddGreg.withChronology(EthiopicChronology.getInstance()).toLocalDate();
                    String date = eddEth.getDayOfMonth() + "/" + eddEth.getMonthOfYear() + "/" + eddEth.getYear();
                    String gott = (mother.getGott() == null) ? "Urban" : mother.getGott();
                    String template = "ID: " + mother.getSeqId() + "\n" + mother.getFullName() + "\n" + gott + "\nEDD: " + date;

                    Reminder reminder = new Reminder();
                    reminder.setStatus("UNCONFIRMED");
                    reminder.setContent(template);
                    reminder.setMother(mother);
                    reminder.setReminderSentOn(new DateTime().toLocalDate().toDate());
                    reminder.setReminderType(textMessage.getMessageType());
                    reminderDao.save(reminder);
                } else {
                    if (textMessage.getStatus().equals("P")) {
                        textMessageDao.changeStatus(textMessage, "R");
                    }
                }
            }
            mainForm.setLogText("\nProcess completed.");
View Full Code Here

Examples of org.springframework.web.socket.TextMessage


  @Override
  public void afterConnectionEstablished(WebSocketSession session) throws Exception {

    final TextMessage tickerMessage = new TextMessage("{\"op\":\"unsubscribe\",\"channel\":\"" + MTGOX_TICKER_CHANNEL + "\"}");
    session.sendMessage(tickerMessage);

    final TextMessage message = new TextMessage("{\"op\":\"unsubscribe\",\"channel\":\"" + MTGOX_DEPTH_CHANNEL + "\"}");
    session.sendMessage(message);

    logger.debug("WebSocket connection to {} established, waiting for messages...", MTGOX_URL);

    session.sendMessage(message);
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.