use of com.rabbitmq.client.LongString in project rabbitmq-java-client by rabbitmq.
the class LongStringTest method testToString.
@Test
public void testToString() throws UnsupportedEncodingException {
String s = "abcdef";
LongString ls = LongStringHelper.asLongString(s);
assertTrue(ls.toString().equals(s));
assertTrue(ls.toString().equals(new String(ls.getBytes(), "UTF-8")));
}
use of com.rabbitmq.client.LongString in project wso2-axis2-transports by wso2.
the class RabbitMQUtils method getTransportHeaders.
public static Map getTransportHeaders(RabbitMQMessage message) {
Map<String, String> map = new HashMap<String, String>();
// correlation ID
if (message.getCorrelationId() != null) {
map.put(RabbitMQConstants.CORRELATION_ID, message.getCorrelationId());
}
// if a AMQP message ID is found
if (message.getMessageId() != null) {
map.put(RabbitMQConstants.MESSAGE_ID, message.getMessageId());
}
// replyto destination name
if (message.getReplyTo() != null) {
String dest = message.getReplyTo();
map.put(RabbitMQConstants.RABBITMQ_REPLY_TO, dest);
}
// any other transport properties / headers
Map<String, Object> headers = message.getHeaders();
if (headers != null && !headers.isEmpty()) {
for (String headerName : headers.keySet()) {
String value = new String(((LongString) (headers.get(headerName))).getBytes());
map.put(headerName, value);
}
}
return map;
}
Aggregations