Examples of ClientMessage


Examples of de.creepsmash.common.messages.client.ClientMessage

  public void run() {
    boolean timeout = false;
    while (!this.terminate) {
      try {
        String messageString = this.bufferedReader.readLine();
        ClientMessage message = ClientMessage.renderMessageString(messageString);
        if (message instanceof InvalidMessage) {
          logger.warn("Client " + this.client.getClientID() + ": " + "received invalid message " + messageString);
          continue;
        }
        if (message instanceof PongMessage) {
View Full Code Here

Examples of org.apache.cayenne.remote.ClientMessage

        ClientConnection connection = mock(ClientConnection.class);
        when(connection.sendMessage((ClientMessage) any())).thenAnswer(
                new Answer<Object>() {

                    public Object answer(InvocationOnMock invocation) {
                        ClientMessage arg = (ClientMessage) invocation.getArguments()[0];

                        if (arg instanceof BootstrapMessage) {
                            return new EntityResolver();
                        }
                        else {
View Full Code Here

Examples of org.hornetq.api.core.client.ClientMessage

  public void run() {
    try {
      start();
      while (running) {
        ClientMessage clientMessage = consumer.receive();
        if (clientMessage!=null) {
          Object object = readMessage(clientMessage);
          String clientId = clientMessage.getStringProperty("producerId");
          handler.messageReceived(session, object, clientId);
        }
      }
    }
    catch (HornetQException e) {
View Full Code Here

Examples of org.hornetq.api.core.client.ClientMessage

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ObjectOutputStream oout;
    try {
      oout = new ObjectOutputStream(baos);
      oout.writeObject(message);
      ClientMessage clientMessage = session.createMessage(true);
      clientMessage.getBodyBuffer().writeBytes(baos.toByteArray());
      producer.send(clientMessage);
    } catch (IOException e) {
      throw new IOException("Error creating message");
    } catch (HornetQException e) {
      throw new IOException("Unable to create message");
View Full Code Here

Examples of org.hornetq.api.core.client.ClientMessage

        public void run() {
          try {
            consumer = session.createConsumer(name);
            while (true) {
              ClientMessage serverMessage = consumer.receive();
              if (serverMessage!=null) {
                ((HornetQTaskClientHandler)handler).messageReceived(session, readMessage(serverMessage), BaseHornetQTaskServer.SERVER_TASK_COMMANDS_QUEUE);
              }
            }
          }
View Full Code Here

Examples of org.hornetq.api.core.client.ClientMessage

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ObjectOutputStream oout;
    try {
      oout = new ObjectOutputStream(baos);
      oout.writeObject(object);
      ClientMessage message = session.createMessage(true);
      message.getBodyBuffer().writeBytes(baos.toByteArray());
      message.putStringProperty("producerId", name);
      producer.send(message);
    } catch (IOException e) {
      throw new RuntimeException("Error creating message", e);
    } catch (HornetQException e) {
      throw new RuntimeException("Error writing message", e);
View Full Code Here

Examples of org.hornetq.api.core.client.ClientMessage

            ClientSession session = null;
            try {
               session = sf.createSession();
               ClientProducer producer = session.createProducer(queueName);
               ClientMessage message = session.createMessage(false);

               final String propName = "myprop";
               message.putStringProperty(propName, "Hello sent at " + new Date());
               System.out.println("Sending the message.");

               producer.send(message);

               ClientConsumer messageConsumer = session.createConsumer(queueName);
               session.start();

               ClientMessage messageReceived = messageConsumer.receive(1000);
               System.out.println("Received TextMessage:" + messageReceived.getStringProperty(propName));
            } finally {
               if (session != null) {
                  session.close();
               }
            }
View Full Code Here

Examples of org.hornetq.api.core.client.ClientMessage

                @Override
                public void run() {
                    while (!shutdown.get()) {
                        try {
                            ClientMessage message = consumer.receive(500);
                            if (message == null) {
                                continue;
                            }
                            String s = message.getStringProperty(BODY);
                            log.info("-----> Received: " + s);
                            synchronized (receivedMessages) {
                                receivedMessages.add(s);
                            }
                        } catch (HornetQException e) {
View Full Code Here

Examples of org.hornetq.api.core.client.ClientMessage

    }

    public void sendMessage(String txt) throws Exception {
        System.out.println("-----> Attempting to send message");
        ClientProducer producer = session.createProducer(QUEUE_EXAMPLE_QUEUE);
        ClientMessage message = session.createMessage(false);

        message.putStringProperty(BODY, "'" + txt + "' sent at " + new Date());
        System.out.println("-----> Sending message");
        producer.send(message);
    }
View Full Code Here

Examples of org.hornetq.api.core.client.ClientMessage

         notifConsumer.setMessageHandler(flowRecord);

         session.start();

         ClientMessage message = session.createMessage(false);
         if (HornetQServerLogger.LOGGER.isTraceEnabled())
         {
            HornetQServerLogger.LOGGER.trace("Requesting sendQueueInfoToQueue through " + this, new Exception("trace"));
         }
         ManagementHelper.putOperationInvocation(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.