{
messageProps = new MessageProperties();
newHeaders.add(messageProps);
}
Header header = new Header(newHeaders);
xfr = new MessageTransfer(_destination,_acceptMode,_acquireMode,header,msg.getBody());
}
else if(serverMsg instanceof AMQMessage)
{
AMQMessage message_0_8 = (AMQMessage) serverMsg;
deliveryProps = new DeliveryProperties();
messageProps = new MessageProperties();
int size = (int) message_0_8.getSize();
ByteBuffer body = ByteBuffer.allocate(size);
message_0_8.getContent(body, 0);
body.flip();
Struct[] headers = new Struct[] { deliveryProps, messageProps };
BasicContentHeaderProperties properties =
(BasicContentHeaderProperties) message_0_8.getContentHeaderBody().properties;
final AMQShortString exchange = message_0_8.getMessagePublishInfo().getExchange();
if(exchange != null)
{
deliveryProps.setExchange(exchange.toString());
}
deliveryProps.setExpiration(message_0_8.getExpiration());
deliveryProps.setImmediate(message_0_8.isImmediate());
deliveryProps.setPriority(MessageDeliveryPriority.get(properties.getPriority()));
deliveryProps.setRedelivered(entry.isRedelivered());
deliveryProps.setRoutingKey(message_0_8.getRoutingKey());
deliveryProps.setTimestamp(properties.getTimestamp());
messageProps.setContentEncoding(properties.getEncodingAsString());
messageProps.setContentLength(size);
if(properties.getAppId() != null)
{
messageProps.setAppId(properties.getAppId().getBytes());
}
messageProps.setContentType(properties.getContentTypeAsString());
if(properties.getCorrelationId() != null)
{
messageProps.setCorrelationId(properties.getCorrelationId().getBytes());
}
// TODO - ReplyTo
if(properties.getUserId() != null)
{
messageProps.setUserId(properties.getUserId().getBytes());
}
FieldTable fieldTable = properties.getHeaders();
final Map<String, Object> appHeaders = FieldTable.convertToMap(fieldTable);
messageProps.setApplicationHeaders(appHeaders);
Header header = new Header(headers);
xfr = new MessageTransfer(_destination,_acceptMode,_acquireMode,header, body);
}
else
{
deliveryProps = new DeliveryProperties();
messageProps = new MessageProperties();
int size = (int) serverMsg.getSize();
ByteBuffer body = ByteBuffer.allocate(size);
serverMsg.getContent(body, 0);
body.flip();
Struct[] headers = new Struct[] { deliveryProps, messageProps };
deliveryProps.setExpiration(serverMsg.getExpiration());
deliveryProps.setImmediate(serverMsg.isImmediate());
deliveryProps.setPriority(MessageDeliveryPriority.get(serverMsg.getMessageHeader().getPriority()));
deliveryProps.setRedelivered(entry.isRedelivered());
deliveryProps.setRoutingKey(serverMsg.getRoutingKey());
deliveryProps.setTimestamp(serverMsg.getMessageHeader().getTimestamp());
messageProps.setContentEncoding(serverMsg.getMessageHeader().getEncoding());
messageProps.setContentLength(size);
messageProps.setContentType(serverMsg.getMessageHeader().getMimeType());
if(serverMsg.getMessageHeader().getCorrelationId() != null)
{
messageProps.setCorrelationId(serverMsg.getMessageHeader().getCorrelationId().getBytes());
}
// TODO - ReplyTo
final Map<String, Object> appHeaders = new HashMap<String, Object>();
/*properties.getHeaders().processOverElements(
new FieldTable.FieldTableElementProcessor()
{
public boolean processElement(String propertyName, AMQTypedValue value)
{
Object val = value.getValue();
if(val instanceof AMQShortString)
{
val = val.toString();
}
appHeaders.put(propertyName, val);
return true;
}
public Object getResult()
{
return appHeaders;
}
});
messageProps.setApplicationHeaders(appHeaders);
*/
Header header = new Header(headers);
xfr = new MessageTransfer(_destination,_acceptMode,_acquireMode,header, body);
}
boolean excludeDueToFederation = false;