-
1. Re: Modify message body in HornetQ transformer?
mattrk Nov 12, 2015 10:06 AM (in response to mattrk)OK. I have sort of worked it out, in case it is useful for others.
I used Qpid Proton to set the message body, so the body is a string in an AmqpValue object -- it is that object that I got back when I called readNullableSimpleString();
The following code retrieves the bytes and presents them in a readable format:
byte[] amqpValue = new byte[message.getBodyBuffer().readableBytes()];
message.getBodyBuffer().getBytes(0, amqpValue);
String byteString = null;
try
{
byteString = new String(amqpValue, "UTF-8");
}
catch (UnsupportedEncodingException e)
{
logger.severe(e.getMessage());
}
logger.info("amqpValue: " + byteString);
So, now it is a simple case of getting/converting the right bytes.
The issue of setting the message body back after modification remains...
Thanks & regards,
Matthew