warnMessage.append(message.toString());
PostOfficeImpl.log.warn(warnMessage.toString());
if (context.getTransaction() != null)
{
context.getTransaction().markAsRollbackOnly(new HornetQException(HornetQException.DUPLICATE_ID_REJECTED, warnMessage.toString()));
}
message.decrementRefCount();
return false;
}
else
{
if (context.getTransaction() == null)
{
context.setTransaction(new TransactionImpl(storageManager));
startedTX.set(true);
}
}
cacheBridge.addToCache(bridgeDupBytes, context.getTransaction());
message.removeProperty(MessageImpl.HDR_BRIDGE_DUPLICATE_ID);
}
else
{
// if used BridgeDuplicate, it's not going to use the regular duplicate
// since this will would break redistribution (re-setting the duplicateId)
byte[] duplicateIDBytes = message.getDuplicateIDBytes();
DuplicateIDCache cache = null;
boolean isDuplicate = false;
if (duplicateIDBytes != null)
{
cache = getDuplicateIDCache(message.getAddress());
isDuplicate = cache.contains(duplicateIDBytes);
if (rejectDuplicates && isDuplicate)
{
String warnMessage = "Duplicate message detected - message will not be routed. Message information:" + message.toString();
PostOfficeImpl.log.warn(warnMessage);
if (context.getTransaction() != null)
{
context.getTransaction().markAsRollbackOnly(new HornetQException(HornetQException.DUPLICATE_ID_REJECTED, warnMessage));
}
message.decrementRefCount();
return false;