本文整理了Java中org.springframework.amqp.core.Message.toString()
方法的一些代码示例,展示了Message.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.toString()
方法的具体详情如下:
包路径:org.springframework.amqp.core.Message
类名称:Message
方法名:toString
暂无
代码示例来源:origin: spring-projects/spring-integration
@Override
public void onSuccess(org.springframework.amqp.core.Message result) {
AbstractIntegrationMessageBuilder<?> replyMessageBuilder = null;
try {
replyMessageBuilder = buildReply(AsyncAmqpOutboundGateway.this.messageConverter, result);
sendOutputs(replyMessageBuilder, this.requestMessage);
}
catch (Exception e) {
Exception exceptionToLogAndSend = e;
if (!(e instanceof MessagingException)) {
exceptionToLogAndSend = new MessageHandlingException(this.requestMessage, e);
if (replyMessageBuilder != null) {
exceptionToLogAndSend =
new MessagingException(replyMessageBuilder.build(), exceptionToLogAndSend);
}
}
logger.error("Failed to send async reply: " + result.toString(), exceptionToLogAndSend);
sendErrorMessage(this.requestMessage, exceptionToLogAndSend);
}
}
代码示例来源:origin: xuyaohui/cloud-ida-cli
@Override
public void returnedMessage(Message message, int i, String s, String s1, String s2) {
System.out.println("sender return success" + message.toString()+"==="+i+"==="+s1+"==="+s2);
}
代码示例来源:origin: org.springframework.integration/spring-integration-amqp
@Override
public void onSuccess(org.springframework.amqp.core.Message result) {
AbstractIntegrationMessageBuilder<?> replyMessageBuilder = null;
try {
replyMessageBuilder = buildReply(AsyncAmqpOutboundGateway.this.messageConverter, result);
sendOutputs(replyMessageBuilder, this.requestMessage);
}
catch (Exception e) {
Exception exceptionToLogAndSend = e;
if (!(e instanceof MessagingException)) {
exceptionToLogAndSend = new MessageHandlingException(this.requestMessage, e);
if (replyMessageBuilder != null) {
exceptionToLogAndSend =
new MessagingException(replyMessageBuilder.build(), exceptionToLogAndSend);
}
}
logger.error("Failed to send async reply: " + result.toString(), exceptionToLogAndSend);
sendErrorMessage(this.requestMessage, exceptionToLogAndSend);
}
}
代码示例来源:origin: spring-projects/spring-amqp
@Test
public void fooNotDeserialized() {
Message message = new SimpleMessageConverter().toMessage(new Foo(), new MessageProperties());
assertThat(message.toString(), not(containsString("aFoo")));
Message listMessage = new SimpleMessageConverter().toMessage(Collections.singletonList(new Foo()),
new MessageProperties());
assertThat(listMessage.toString(), not(containsString("aFoo")));
Message.addWhiteListPatterns(Foo.class.getName());
assertThat(message.toString(), containsString("aFoo"));
assertThat(listMessage.toString(), containsString("aFoo"));
}
代码示例来源:origin: spring-projects/spring-amqp
@Test
public void toStringForNonStringMessageBody() {
Message message = new Message(SerializationUtils.serialize(new Date()), null);
assertNotNull(message.toString());
}
代码示例来源:origin: spring-projects/spring-amqp
@Test
public void serialization() throws Exception {
MessageProperties messageProperties = new MessageProperties();
messageProperties.setDeliveryMode(MessageDeliveryMode.NON_PERSISTENT);
messageProperties.setHeader("foo", "bar");
messageProperties.setContentType("text/plain");
Message message = new Message("baz".getBytes(), messageProperties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream os = new ObjectOutputStream(baos);
os.writeObject(message);
os.close();
ObjectInputStream is = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
Message out = (Message) is.readObject();
assertEquals(new String(message.getBody()), new String(out.getBody()));
assertEquals(message.toString(), out.toString());
}
代码示例来源:origin: spring-projects/spring-amqp
@Test
public void toStringForNullMessageProperties() {
Message message = new Message(new byte[0], null);
assertNotNull(message.toString());
}
代码示例来源:origin: spring-projects/spring-amqp
@Test
public void toStringForNonSerializableMessageBody() {
MessageProperties messageProperties = new MessageProperties();
messageProperties.setContentType(MessageProperties.CONTENT_TYPE_SERIALIZED_OBJECT);
Message message = new Message("foo".getBytes(), messageProperties);
assertNotNull(message.toString());
}
代码示例来源:origin: spring-projects/spring-amqp
@Test
public void toStringForSerializableMessageBody() {
MessageProperties messageProperties = new MessageProperties();
messageProperties.setContentType(MessageProperties.CONTENT_TYPE_SERIALIZED_OBJECT);
Message message = new Message(SerializationUtils.serialize(new Date()), messageProperties);
assertNotNull(message.toString());
}
代码示例来源:origin: spring-projects/spring-amqp
@Test
public void toStringForEmptyMessageBody() {
Message message = new Message(new byte[0], new MessageProperties());
assertNotNull(message.toString());
}
内容来源于网络,如有侵权,请联系作者删除!