Examples of MessageConverter


Examples of org.springframework.amqp.support.converter.MessageConverter

        MessageProperties messageProperties = message.getMessageProperties();
        String contentType = messageProperties.getContentType();
        if(messageProperties == null)
            throw new MessageConversionException("Cannot decode a message with no properties!");
       
        MessageConverter converter = converters.get(contentType);
        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

        public void run() {
            org.apache.camel.Message message = exchange.getIn();
            SpringAMQPMessage inMessage = new SpringAMQPMessage(message);
            exchange.setIn(inMessage); //Swap out the old message format

            MessageConverter msgConverter;
            if(endpoint.getAmqpTemplate() instanceof RabbitTemplate) {
                RabbitTemplate rabbitTemplate = (RabbitTemplate) endpoint.getAmqpTemplate();
                msgConverter = rabbitTemplate.getMessageConverter();
            } else {
                LOG.warn("Cannot find RabbitMQ AMQP Template, falling back to simple message converter");
View Full Code Here

Examples of org.springframework.amqp.support.converter.MessageConverter

    public void process(Exchange exchange) throws Exception {
        org.apache.camel.Message message = exchange.getIn();
        SpringAMQPMessage inMessage = new SpringAMQPMessage(message);
        exchange.setIn(inMessage); //Swap out the old message format
       
        MessageConverter msgConverter;
        if(this.endpoint.getAmqpTemplate() instanceof RabbitTemplate) {
            RabbitTemplate rabbitTemplate = (RabbitTemplate) this.endpoint.getAmqpTemplate();
            msgConverter = rabbitTemplate.getMessageConverter();
        } else {
            LOG.warn("Cannot find RabbitMQ AMQP Template, falling back to simple message converter");
View Full Code Here

Examples of org.springframework.amqp.support.converter.MessageConverter

    return new Message(response.getBody(), messageProps);
  }

  private MessageConverter getRequiredMessageConverter()
      throws IllegalStateException {
    MessageConverter converter = this.getMessageConverter();
    if (converter == null) {
      throw new AmqpIllegalStateException(
          "No 'messageConverter' specified. Check configuration of RabbitTemplate.");
    }
    return converter;
View Full Code Here

Examples of org.springframework.jms.support.converter.MessageConverter

   * @return the content of the message, to be passed into the
   * listener method as argument
   * @throws JMSException if thrown by JMS API methods
   */
  protected Object extractMessage(Message message) throws JMSException {
    MessageConverter converter = getMessageConverter();
    if (converter != null) {
      return converter.fromMessage(message);
    }
    return message;
  }
View Full Code Here

Examples of org.springframework.jms.support.converter.MessageConverter

   * @return the JMS <code>Message</code> (never <code>null</code>)
   * @throws JMSException if thrown by JMS API methods
   * @see #setMessageConverter
   */
  protected Message buildMessage(Session session, Object result) throws JMSException {
    MessageConverter converter = getMessageConverter();
    if (converter != null) {
      return converter.toMessage(result, session);
    }
    else {
      if (!(result instanceof Message)) {
        throw new MessageConversionException(
            "No MessageConverter specified - cannot handle message [" + result + "]");
View Full Code Here

Examples of org.springframework.jms.support.converter.MessageConverter

  public MessageConverter getMessageConverter() {
    return this.messageConverter;
  }

  private MessageConverter getRequiredMessageConverter() throws IllegalStateException {
    MessageConverter converter = getMessageConverter();
    if (converter == null) {
      throw new IllegalStateException("No 'messageConverter' specified. Check configuration of JmsTemplate.");
    }
    return converter;
  }
View Full Code Here

Examples of org.springframework.jms.support.converter.MessageConverter

  public MessageConverter getMessageConverter() {
    return this.messageConverter;
  }

  private MessageConverter getRequiredMessageConverter() throws IllegalStateException {
    MessageConverter converter = getMessageConverter();
    if (converter == null) {
      throw new IllegalStateException("No 'messageConverter' specified. Check configuration of JmsTemplate.");
    }
    return converter;
  }
View Full Code Here

Examples of org.springframework.jms.support.converter.MessageConverter

   * @return the content of the message, to be passed into the
   * listener method as argument
   * @throws JMSException if thrown by JMS API methods
   */
  protected Object extractMessage(Message message) throws JMSException {
    MessageConverter converter = getMessageConverter();
    if (converter != null) {
      return converter.fromMessage(message);
    }
    return message;
  }
View Full Code Here

Examples of org.springframework.jms.support.converter.MessageConverter

   * @return the JMS <code>Message</code> (never <code>null</code>)
   * @throws JMSException if thrown by JMS API methods
   * @see #setMessageConverter
   */
  protected Message buildMessage(Session session, Object result) throws JMSException {
    MessageConverter converter = getMessageConverter();
    if (converter != null) {
      return converter.toMessage(result, session);
    }
    else {
      if (!(result instanceof Message)) {
        throw new MessageConversionException(
            "No MessageConverter specified - cannot handle message [" + result + "]");
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.