Examples of ReceivedMessage


Examples of com.rabbitmq.messagepatterns.unicast.ReceivedMessage

      }
    };
  }
 
  protected void assertMessageReceived(String msg) throws Exception {
      ReceivedMessage message = receiver.receive(1000);
      assertEquals(msg, new String(message.getBody()));
  }
View Full Code Here

Examples of com.rabbitmq.messagepatterns.unicast.ReceivedMessage

        }
    }

    private void readFromQueue() throws Exception {
        while (executor != null && !executor.isShutdown()) {
            ReceivedMessage message = receiver.receive();
            if(message != null) {
                LOG.debug("Recieved message from queue {}", queueName);

                Exchange exchange = getEndpoint().createExchange();

                Message msg = new DefaultMessage();
                msg.setBody(message.getBody());
                exchange.setIn(msg);
                getProcessor().process(exchange);
                receiver.ack(message);
            }
        }
View Full Code Here

Examples of com.rabbitmq.messagepatterns.unicast.ReceivedMessage

    public void senderSendsMessagesAndReceiverReceivesThem() throws Exception {
        Message msg = sender.createMessage();
        msg.setBody(MESSAGE_BODY.getBytes());
        sender.send(msg);
       
        ReceivedMessage msg2 = receiver.receive(1000);
        receiver.ack(msg2);
        assertEquals(MESSAGE_BODY, new String(msg2.getBody()));
       
        sender.stop();
        receiver.stop();
    }
View Full Code Here

Examples of evolaris.framework.async.datamodel.ReceivedMessage

      if(message instanceof ObjectMessage) {
        ObjectMessage oMessage = (ObjectMessage)message;
        try {
          Object messageObject = oMessage.getObject();
          if(messageObject instanceof ReceivedMessage) {
            ReceivedMessage incomingMessage = (ReceivedMessage)messageObject;
            Invocation invocation = incomingMessage.getInvocation();
            Group group = invocation.getGroup()// group and group.clientProject must have been initialized (no lazy Hibernate loading possible here)
            Session session = HibernateSessions.startTransaction(getClass(),group.getId(),group.getClientProject().getHibernateConfigurationFile());
            try {
              session.load(invocation,invocation.getId())// reload because from different session; this may actually fail if the invocation entry was deleted
View Full Code Here

Examples of org.jdesktop.wonderland.common.messages.MessagePacker.ReceivedMessage

        public void receivedMessage(ByteBuffer message) {
            Message m = null;
           
            try {
                ReceivedMessage rm = MessagePacker.unpack(message);
                m = rm.getMessage();
          
                // check the response
                assert m instanceof ResponseMessage : "Received invalid response " + m;
                assert m.getMessageID().equals(messageID) : "Bad ID in response " + m;
            } catch (PackerException pe) {
View Full Code Here

Examples of org.jdesktop.wonderland.common.messages.MessagePacker.ReceivedMessage

        Message message;
        short clientID;
       
        try {
            // read the message
            ReceivedMessage recv = MessagePacker.unpack(data, getClassLoader());
           
            // all set, just unpack the received message
            message = recv.getMessage();
            clientID = recv.getClientID();
        } catch (PackerException eme) {
            logger.log(Level.WARNING, "Error extracting message from server",
                       eme);

            // if possible, send an error reply to the client
View Full Code Here

Examples of org.jdesktop.wonderland.common.messages.MessagePacker.ReceivedMessage

     * @param data the message data
     */
    public void receivedMessage(ByteBuffer data) {
        try {
            // extract the message and client id
            ReceivedMessage recv = MessagePacker.unpack(data);
            Message m = recv.getMessage();
            short clientID = recv.getClientID();
           
            // find the handler
            ClientConnectionHandler handler = getHandler(clientID);
            if (handler == null) {
                logger.fine("Session " + getSession().getName() +
View Full Code Here

Examples of org.jdesktop.wonderland.common.messages.MessagePacker.ReceivedMessage

       
        // no wrapped session -- look for a ProtocolSelectionMessage
        try {
            // the message contains a client identifier in the first
            // 2 bytes, so ignore those
            ReceivedMessage recv = MessagePacker.unpack(data);
            Message m = recv.getMessage();
           
            // check the message type
            if (!(m instanceof ProtocolSelectionMessage)) {
                sendError(m, "Only ProtcolSelectionMessage allowed");
                return;
View Full Code Here

Examples of org.jtestserver.common.protocol.ReceivedMessage

    /* (non-Javadoc)
     * @see org.jtestserver.common.protocol.Server#receive(org.jtestserver.common.protocol.MessageProcessor)
     */
    @Override
    public synchronized void receive(MessageProcessor processor) throws ProtocolException, TimeoutException {
        ReceivedMessage receivedMessage = protocol.receiveMessage(socket);
        String reply = processor.process(receivedMessage.getMessage());
       
        if (reply != MessageProcessor.NO_RESPONSE) {
            protocol.sendMessage(socket, reply, receivedMessage.getRemoteAddress());
        }
    }
View Full Code Here

Examples of org.jtestserver.common.protocol.ReceivedMessage

            // receive actual data
            data = new byte[size];
            packet = new DatagramPacket(data, data.length);
            socket.receive(packet);
           
            return new ReceivedMessage(new String(packet.getData()), packet.getSocketAddress());
           
//            ByteBuffer bb = ByteBuffer.allocate(INT_SIZE);
//            socket.getChannel().read(bb);
//            int size = bb.getInt();
//            bb = ByteBuffer.allocate(size);
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.