Package org.springframework.amqp.support.converter

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


    connectionFactory.setHost("localhost");
    connectionFactory.setChannelCacheSize(concurrentConsumers);
    connectionFactory.setPort(BrokerTestUtils.getPort());
    template.setConnectionFactory(connectionFactory);
    if (messageConverter == null) {
      SimpleMessageConverter messageConverter = new SimpleMessageConverter();
      messageConverter.setCreateMessageIds(true);
      this.messageConverter = messageConverter;
    }
    template.setMessageConverter(messageConverter);
    return template;
  }
View Full Code Here


    int messageCount = 2;
    int txSize = 1;
    int failFrequency = 1;
    int concurrentConsumers = 1;
    SimpleMessageConverter messageConverter = new SimpleMessageConverter();
    // There will be no key for these messages so they cannot be recovered...
    messageConverter.setCreateMessageIds(false);
    this.messageConverter = messageConverter;
    // Beware of context cache busting if retry policy fails...
    this.retryTemplate = new RetryTemplate();
    this.retryTemplate.setRetryContextCache(new MapRetryContextCache(1));
    // The container should have shutdown, so there are now no active consumers
View Full Code Here

    connectionFactory.setHost("localhost");
    connectionFactory.setUsername("guest");
    connectionFactory.setPassword("guest");
    assertNotNull(connectionFactory);

    MessageConverter messageConverter = new SimpleMessageConverter();
    MessageProperties  messageProperties = new MessageProperties();
    messageProperties.setContentType(MessageProperties.CONTENT_TYPE_TEXT_PLAIN);

    SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
    container.setConnectionFactory(connectionFactory);
View Full Code Here

    CachingConnectionFactory connectionFactory = new CachingConnectionFactory();
    connectionFactory.setHost("localhost");
    connectionFactory.setChannelCacheSize(concurrentConsumers);
    connectionFactory.setPort(BrokerTestUtils.getPort());
    template.setConnectionFactory(connectionFactory);
    SimpleMessageConverter messageConverter = new SimpleMessageConverter();
    messageConverter.setCreateMessageIds(true);
    template.setMessageConverter(messageConverter);
    for (int i = 0; i < messageCount; i++) {
      template.convertAndSend(queue1.getName(), new Integer(i));
      template.convertAndSend(queue2.getName(), new Integer(i));
    }
View Full Code Here

          throw (RuntimeException) ex;
        }
        throw new IllegalStateException(ex);
      };
    };
    adapter.setMessageConverter(new SimpleMessageConverter());
  }
View Full Code Here

    messagingTemplate.convertAndSend("my Payload");
  }

  @Test
  public void convertAndSendCustomAmqpMessageConverter() {
    messagingTemplate.setAmqpMessageConverter(new SimpleMessageConverter() {

      @Override
      protected org.springframework.amqp.core.Message createMessage(Object object,
          MessageProperties messageProperties) throws MessageConversionException {
        throw new MessageConversionException("Test exception");
View Full Code Here

  /**
   * Set up the default strategies. Subclasses can override if necessary.
   */
  protected void initDefaultStrategies() {
    setMessageConverter(new SimpleMessageConverter());
  }
View Full Code Here

        GetResponse response = channel.basicGet(ROUTE, false);
        MessageProperties messageProps = messagePropertiesConverter.toMessageProperties(
            response.getProps(), response.getEnvelope(), "UTF-8");
        // Explicit ack
        channel.basicAck(response.getEnvelope().getDeliveryTag(), false);
        return (String) new SimpleMessageConverter().fromMessage(new Message(response.getBody(), messageProps));
      }
    });
    assertEquals("message", result);
    result = (String) template.receiveAndConvert(ROUTE);
    assertEquals(null, result);
View Full Code Here

  private String getResult(final BlockingQueueConsumer consumer) throws InterruptedException {
    Message response = consumer.nextMessage(2000L);
    if (response == null) {
      return null;
    }
    return (String) new SimpleMessageConverter().fromMessage(response);
  }
View Full Code Here

            }
            catch (InterruptedException e) {
              Thread.currentThread().interrupt();
            }
            templateWithConfirmsEnabled.doSend(channel, "", ROUTE,
                new SimpleMessageConverter().toMessage("message", new MessageProperties()),
                new CorrelationData("def"));
            return null;
          }
        });
      }
View Full Code Here

TOP

Related Classes of org.springframework.amqp.support.converter.SimpleMessageConverter

Copyright © 2018 www.massapicom. 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.