Package org.springframework.amqp.core

Examples of org.springframework.amqp.core.MessageProperties


    MessagingMessageListenerAdapter listener = createDefaultInstance(String.class);
    listener.setMandatoryPublish(true);
    String body = "echo text";
    Address replyTo = new Address("replyToQueue", "myRouting");

    MessageProperties properties = new MessageProperties();
    properties.setReplyToAddress(replyTo);
    org.springframework.amqp.core.Message message = createTextMessage(body, properties);


    processAndReply(listener, message, "replyToQueue", "myRouting", true, null);
    assertDefaultListenerMethodInvocation();
View Full Code Here


  public void processAndReplyWithSendTo() throws Exception {
    MessagingMessageListenerAdapter listener = createDefaultInstance(String.class);
    String body = "echo text";
    String messageId = "msgId-1234";

    MessageProperties properties = new MessageProperties();
    properties.setMessageId(messageId);
    org.springframework.amqp.core.Message message = createTextMessage(body, properties);

    // MessageId is used as fallback when no correlationId is set
    processAndReply(listener, message, "replyDestination", "", false, messageId);
    assertDefaultListenerMethodInvocation();
View Full Code Here

    Map<String, Object> headers = new HashMap<String, Object>();
    headers.put("longString", longString);
    BasicProperties source = new BasicProperties.Builder()
        .headers(headers)
        .build();
    MessageProperties messageProperties = messagePropertiesConverter.toMessageProperties(source, envelope, "UTF-8");
    assertEquals("LongString not converted to String",
        longStringString, messageProperties.getHeaders().get("longString"));
  }
View Full Code Here

    Map<String, Object> headers = new HashMap<String, Object>();
    headers.put("list", Arrays.asList(longString));
    BasicProperties source = new BasicProperties.Builder()
        .headers(headers)
        .build();
    MessageProperties messageProperties = messagePropertiesConverter.toMessageProperties(source, envelope, "UTF-8");
    assertEquals("LongString nested in List not converted to String",
        longStringString, ((List<?>) messageProperties.getHeaders().get("list")).get(0));
  }
View Full Code Here

    Map<String, Object> headers = new HashMap<String, Object>();
    headers.put("list", Arrays.asList(Arrays.asList(longString)));
    BasicProperties source = new BasicProperties.Builder()
        .headers(headers)
        .build();
    MessageProperties messageProperties = messagePropertiesConverter.toMessageProperties(source, envelope, "UTF-8");
    assertEquals("LongString deeply nested in List not converted to String",
        longStringString, ((List<?>) ((List<?>) messageProperties.getHeaders().get("list")).get(0)).get(0));
  }
View Full Code Here

    Map<String, Object> headers = new HashMap<String, Object>();
    headers.put("map", mapWithLongString);
    BasicProperties source = new BasicProperties.Builder()
        .headers(headers)
        .build();
    MessageProperties messageProperties = messagePropertiesConverter.toMessageProperties(source, envelope, "UTF-8");
    assertEquals("LongString nested in Map not converted to String",
        longStringString, ((Map<String, Object>) messageProperties.getHeaders().get("map")).get("longString"));
  }
View Full Code Here

        longStringString, ((Map<String, Object>) messageProperties.getHeaders().get("map")).get("longString"));
  }

  @Test
  public void testFromUnsupportedValue() {
    MessageProperties messageProperties = new MessageProperties();
    messageProperties.setHeader("unsupported", new Object());
    BasicProperties basicProps = messagePropertiesConverter.fromMessageProperties(messageProperties, "UTF-8");
    assertTrue("Unsupported value not converted to String",
        basicProps.getHeaders().get("unsupported") instanceof String);
  }
View Full Code Here

        basicProps.getHeaders().get("unsupported") instanceof String);
  }

  @Test
  public void testFromUnsupportedValueInList() {
    MessageProperties messageProperties = new MessageProperties();
    List<Object> listWithUnsupportedValue = Arrays.asList(new Object());
    messageProperties.setHeader("list", listWithUnsupportedValue);
    BasicProperties basicProps = messagePropertiesConverter.fromMessageProperties(messageProperties, "UTF-8");
    assertTrue("Unsupported value nested in List not converted to String",
        ((List<?>) basicProps.getHeaders().get("list")).get(0) instanceof String);
  }
View Full Code Here

  }

  @Test
  @SuppressWarnings("unchecked")
  public void testFromUnsupportedValueDeepInList() {
    MessageProperties messageProperties = new MessageProperties();
    List<List<Object>> listWithUnsupportedValue = Arrays.asList(Arrays.asList(new Object()));
    messageProperties.setHeader("list", listWithUnsupportedValue);
    BasicProperties basicProps = messagePropertiesConverter.fromMessageProperties(messageProperties, "UTF-8");
    assertTrue("Unsupported value deeply nested in List not converted to String",
        ((List<Object>) ((List<?>) basicProps.getHeaders().get("list")).get(0)).get(0) instanceof String);
  }
View Full Code Here

  }

  @Test
  @SuppressWarnings("unchecked")
  public void testFromUnsupportedValueInMap() {
    MessageProperties messageProperties = new MessageProperties();
    Map<String, Object> mapWithUnsupportedValue = new HashMap<String, Object>();
    mapWithUnsupportedValue.put("unsupported", new Object());
    messageProperties.setHeader("map", mapWithUnsupportedValue);
    BasicProperties basicProps = messagePropertiesConverter.fromMessageProperties(messageProperties, "UTF-8");
    assertTrue("Unsupported value nested in Map not converted to String",
        ((Map<String, Object>) basicProps.getHeaders().get("map")).get("unsupported") instanceof String);
  }
View Full Code Here

TOP

Related Classes of org.springframework.amqp.core.MessageProperties

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.