Examples of fromMessage()


Examples of org.springframework.amqp.support.converter.JsonMessageConverter.fromMessage()

    Map<String, Object> headerMap = new HashMap<String, Object>();
    headerMap.put("__TypeId__", "java.lang.Integer");
    MessageHeaders messageHeaders = new MessageHeaders(headerMap);
    headerMapper.fromHeaders(messageHeaders, amqpProperties);
    assertEquals("java.lang.String", amqpProperties.getHeaders().get("__TypeId__"));
    Object result = converter.fromMessage(new Message("123".getBytes(), amqpProperties));
    assertEquals(String.class, result.getClass());
  }

}
View Full Code Here

Examples of org.springframework.amqp.support.converter.MessageConverter.fromMessage()

        if(converter == null) //Try to fall back
            converter = this.fallbackConverter;
        if(converter == null) //Can't even fall back, punt
            throw new MessageConversionException("Cannot find converter for content type of "+contentType);
       
        return converter.fromMessage(message);
    }
}
View Full Code Here

Examples of org.springframework.amqp.support.converter.MessageConverter.fromMessage()

        MessageConverter converter = new XStreamConverter();
        ((XStreamConverter) converter).setEncoding("UTF-8");
        Message amqpMessage = converter.toMessage(testObject, messageProperties);
        Assert.assertEquals("{\"amqp.spring.converter.XStreamConverterTest_-TestObject\":{\"value\":\"TESTING\"}}", new String(amqpMessage.getBody()));

        Object newObject = converter.fromMessage(amqpMessage);
        Assert.assertEquals(testObject, newObject);
        Assert.assertEquals("UTF-8", ((XStreamConverter) converter).getEncoding());
    }
   
    private static class TestObject implements Serializable {
View Full Code Here

Examples of org.springframework.amqp.support.converter.MessageConverter.fromMessage()

       
        MessageProperties messageProperties = new MessageProperties();
       
        MessageConverter converter = new StringConverter();
        Message amqpMessage = converter.toMessage(testObject, messageProperties);
        Object newObject = converter.fromMessage(amqpMessage);
       
        Assert.assertEquals("TESTING", newObject);
    }
   
    private static class TestObject implements Serializable {
View Full Code Here

Examples of org.springframework.amqp.support.converter.MessageConverter.fromMessage()

        listenerContainer.setQueueNames(rabbitQueue.getName());

        // set the callback for message handling
        listenerContainer.setMessageListener(new MessageListener() {
            public void onMessage(Message message) {
                final BigOperation bigOp = (BigOperation) messageConverter.fromMessage(message);

                // simply printing out the operation, but expensive computation could happen here
                System.out.println("Received from RabbitMQ: " + bigOp);
            }
        });
View Full Code Here

Examples of org.springframework.amqp.support.converter.MessageConverter.fromMessage()

        if(converter == null) //Try to fall back
            converter = this.fallbackConverter;
        if(converter == null) //Can't even fall back, punt
            throw new MessageConversionException("Cannot find converter for content type of "+contentType);
       
        return converter.fromMessage(message);
    }
}
View Full Code Here

Examples of org.springframework.amqp.support.converter.MessageConverter.fromMessage()

        final CountDownLatch fooLatch = new CountDownLatch(1);
        final CountDownLatch barLatch = new CountDownLatch(2);
        final List<BigOperation> receievedMessageHolder = new ArrayList<BigOperation>(2);
        container.setMessageListener(new MessageListener() {
            public void onMessage(Message message) {
                receievedMessageHolder.add((BigOperation) messageConverter.fromMessage(message));
                fooLatch.countDown();
                barLatch.countDown();
            }
        });
        container.setErrorHandler(new ErrorHandler() {
View Full Code Here

Examples of org.springframework.amqp.support.converter.MessageConverter.fromMessage()

   * @return the content of the message, to be passed into the listener method as argument
   */
  protected Object extractMessage(Message message) {
    MessageConverter converter = getMessageConverter();
    if (converter != null) {
      return converter.fromMessage(message);
    }
    return message;
  }

  /**
 
View Full Code Here

Examples of org.springframework.amqp.support.converter.MessageConverter.fromMessage()

        Message message = messageConverter.toMessage(payload, messageProperties);

        serviceExporter.onMessage(message);

        Message resultMessage = sentSavingTemplate.getLastMessage();
        return messageConverter.fromMessage(resultMessage);
      }
    };
    amqpProxyFactoryBean.setAmqpTemplate(directForwardingTemplate);
    amqpProxyFactoryBean.afterPropertiesSet();
    Object rawProxy = amqpProxyFactoryBean.getObject();
View Full Code Here

Examples of org.springframework.amqp.support.converter.SimpleMessageConverter.fromMessage()

        listenerContainer.setQueueNames(rabbitQueue.getName());

        // set the callback for message handling
        listenerContainer.setMessageListener(new MessageListener() {
            public void onMessage(Message message) {
                final BigOperation bigOp = (BigOperation) messageConverter.fromMessage(message);

                // simply printing out the operation, but expensive computation could happen here
                System.out.println("Received from RabbitMQ: " + bigOp);
            }
        });
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.