ARTEMIS-3395 ensure sending audit log contains message ID

This commit is contained in:
Justin Bertram 2021-07-21 10:58:47 -05:00 committed by clebertsuconic
parent 1d15fb1a3f
commit bb9bbf062d
2 changed files with 5 additions and 4 deletions

View File

@ -1777,10 +1777,6 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
final boolean direct,
boolean noAutoCreateQueue,
RoutingContext routingContext) throws Exception {
if (AuditLogger.isMessageEnabled()) {
AuditLogger.coreSendMessage(getUsername(), messageParameter.toString(), routingContext);
}
final Message message = LargeServerMessageImpl.checkLargeMessage(messageParameter, storageManager);
if (server.hasBrokerMessagePlugins()) {
@ -1806,6 +1802,10 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
message.setMessageID(id);
}
if (AuditLogger.isMessageEnabled()) {
AuditLogger.coreSendMessage(getUsername(), message.toString(), routingContext);
}
SimpleString address = message.getAddressSimpleString();
if (defaultAddress == null && address != null) {

View File

@ -207,6 +207,7 @@ public class AuditLoggerTest extends SmokeTestBase {
Wait.waitFor(() -> addressControl.getMessageCount() == 2);
Assert.assertEquals(2, addressControl.getMessageCount());
checkAuditLogRecord(false, "messageID=0");
checkAuditLogRecord(true, "sending a message");
checkAuditLogRecord(true, uniqueStr);
checkAuditLogRecord(true, "Hello2");