Examples of TextMessage


Examples of javax.jms.TextMessage

        return session.createTextMessage(xml);
    }

    public RemoteInvocationResult extractInvocationResult(Message message) throws JMSException {
        if (message instanceof TextMessage) {
            TextMessage textMessage = (TextMessage) message;
            String text = textMessage.getText();
            return (RemoteInvocationResult) fromXML(text);
        }
        return super.extractInvocationResult(message);
    }
View Full Code Here

Examples of javax.jms.TextMessage

        return super.extractInvocationResult(message);
    }

    public RemoteInvocation readRemoteInvocation(Message message) throws JMSException {
        if (message instanceof TextMessage) {
            TextMessage textMessage = (TextMessage) message;
            String text = textMessage.getText();
            return (RemoteInvocation) fromXML(text);
        }
        return super.readRemoteInvocation(message);
    }
View Full Code Here

Examples of javax.jms.TextMessage

      // connection for messagequeues and creates a JMS-QueueBrowser for
      // the given queue.
      MQConnection mqCon = MQConnection.getInstance();
      QueueBrowser qb = mqCon.getBrowser(new XBUSSystem(logQueuename));

      TextMessage message = null;

      Enumeration e = qb.getEnumeration();

      while (e.hasMoreElements())
      {
        message = (TextMessage) e.nextElement();
        System.out.print(message.getText());
        System.out.print(Constants.QUEUE_DUMP_DELIMITER);
      }

      mqCon.commit();
      mqCon.close();
View Full Code Here

Examples of javax.jms.TextMessage

      // priority.
      for (Enumeration e = messageVec.elements(); e.hasMoreElements();)
      {
        try
        {
          TextMessage message = mqCon.createTextMessage();
          message.setText((String) e.nextElement());
          qs.send(message);
        }
        catch (JMSException ex)
        {
          System.out.println("Exception gefangen!");
View Full Code Here

Examples of javax.jms.TextMessage

      // connection for messagequeues and creates a JMS-QueueBrowser for
      // the given queue.
      MQConnection mqCon = MQConnection.getInstance();
      QueueBrowser qb = mqCon.getBrowser(new XBUSSystem(logQueuename));

      TextMessage message = null;
      Date timestamp = new Date();

      Enumeration e = qb.getEnumeration();

      while (e.hasMoreElements())
      {
        message = (TextMessage) e.nextElement();
        timestamp.setTime(message.getJMSTimestamp());
        System.out.println(Constants.getDateFormat().format(timestamp)
            + " " + message.getText());
      }

      mqCon.commit();
      mqCon.close();
    }
View Full Code Here

Examples of javax.jms.TextMessage

      int messageCounter = 0;

      // Use a TextMessage object to receive a message containing a
      // java.lang.String
      // in read-only mode.
      TextMessage message = null;

      boolean messageFound = false;
      while (!messageFound && (messageCounter < numMessages))
      {
        try
        {
          // Use this method to receive the next message that arrives
          // within the specified timeout interval.
          // This call blocks until a message arrives, the timeout
          // expires,
          // or this message consumer is closed.
          message = (TextMessage) qr.receive(1000);

          if (message == null)
          {
            System.out.println("Keine Nachricht vorhanden!");
            messageFound = true;
          }
          else
          {
            messageCounter++;
            commitCounter++;
            System.out.println("Nachricht-Nr. " + messageCounter
                + " empfangen: " + message.getText());

            if (commitCounter == mCommitRate)
            {
              commitCounter = 0;
              mqCon.commit();
View Full Code Here

Examples of javax.jms.TextMessage

         log.info("initial update requested with no real initial data for '" + SpecificDefault.toString(slaveSessionNames) + "' and for replication '" + this.replPrefix + "'");

      // send the message for the status change
      if (initialFilesLocation != null) {
         // then we save it in a file but we must tell it is finished now
         TextMessage  endMsg = session.createTextMessage();
         endMsg.setText("INITIAL UPDATE WILL BE STORED UNDER '" + initialFilesLocation + "'");
         endMsg.setBooleanProperty(INITIAL_DATA_END, true);
         endMsg.setStringProperty(INITIAL_DATA_ID, dumpId);
         endMsg.setStringProperty(INITIAL_FILES_LOCATION, initialFilesLocation);
         producer.send(endMsg);
         endMsg = session.createTextMessage();
         endMsg.setText("INITIAL UPDATE WILL BE STORED UNDER '" + initialFilesLocation + "' (going to remote)");
         endMsg.setBooleanProperty(INITIAL_DATA_END_TO_REMOTE, true);
         endMsg.setStringProperty(INITIAL_DATA_ID, dumpId);
         endMsg.setStringProperty(INITIAL_FILES_LOCATION, initialFilesLocation);
         producer.send(endMsg);
      }
      sendInitialDataResponseOnly(slaveSessionNames, replManagerAddress, minKey, maxKey);
      if (replSourceEngine != null)
         replSourceEngine.sendEndOfTransitionMessage(info, session, initialFilesLocation, shortFilename, dumpId, producer);
View Full Code Here

Examples of javax.jms.TextMessage

        LingoInvocation invocation = new LingoInvocation("foo", new Class[0], new Object[0], new MethodMetadata(false));
        Message message = marshaller.createRequestMessage(requestor, invocation);

        assertTrue("Should have created a text message: " + message, message instanceof TextMessage);

        TextMessage textMessage = (TextMessage) message;
        String text = textMessage.getText();
        assertTrue("Should have created a valid string", text != null && text.length() > 0);

        System.out.println("XML is: ");
        System.out.println(text);
    }
View Full Code Here

Examples of javax.jms.TextMessage

         Session producerSession = connection.createSession(transacted, ackMode);
         MessageProducer publisher = producerSession.createProducer(this.topic);
         connection.start();

         for (int i=0; i < this.nmax; i++) {
            TextMessage msg = producerSession.createTextMessage();
            msg.setText("this is a " + type + " jms message nr. " + i);
            publisher.send(this.topic, msg);
         }
        
         if (ackMode == Session.CLIENT_ACKNOWLEDGE) {
            for (int i=0; i < this.nmax; i++) {
View Full Code Here

Examples of javax.jms.TextMessage

         String topic = null;
         String sessionName = "hello/1";
         MessageProducer producer = session.createProducer(new XBDestination(topic, sessionName));
         // producer.setPriority(PriorityEnum.HIGH_PRIORITY.getInt());
         // producer.setDeliveryMode(DeliveryMode.PERSISTENT);
         TextMessage msg = session.createTextMessage();
         msg.setText("Hallo");
         producer.send(msg);
      }
      catch (Exception ex) {
         ex.printStackTrace();
      }
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.