jbertram commented on code in PR #4421:
URL: https://github.com/apache/activemq-artemis/pull/4421#discussion_r1161962145
##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java:
##########
@@ -1742,49 +1743,80 @@ public Transaction getCurrentTransaction() {
return tx;
}
-
@Override
- public boolean checkAutoCreate(SimpleString address, RoutingType
routingType) throws Exception {
- boolean result;
- SimpleString unPrefixedAddress = removePrefix(address);
+ public AutoCreateResult checkAutoCreate(QueueConfiguration queueConfig)
throws Exception {
+ AutoCreateResult result;
+ SimpleString unPrefixedAddress = removePrefix(queueConfig.getAddress());
AddressSettings addressSettings =
server.getAddressSettingsRepository().getMatch(unPrefixedAddress.toString());
- if (routingType == RoutingType.MULTICAST) {
- if (server.getAddressInfo(unPrefixedAddress) == null) {
- if (addressSettings.isAutoCreateAddresses()) {
+ /*
+ *
+ */
+ if (queueConfig.getRoutingType() == null) {
+ return AutoCreateResult.EXISTED;
+ }
+
+ // No matter what routingType is used the address must exist already or
be automatically created
+ AddressInfo addressInfo = server.getAddressInfo(unPrefixedAddress);
+ if (addressInfo == null) {
+ // the address doesn't exist
+ if (addressSettings.isAutoCreateAddresses() ||
queueConfig.isTemporary()) {
+ // try to create the address if possible
+ try {
+ createAddress(queueConfig.getAddress(),
queueConfig.getRoutingType(), true).setTemporary(queueConfig.isTemporary());
+ } catch (ActiveMQAddressExistsException e) {
+ // The address may have been created by another thread in the
mean time. Catch and do nothing.
+ }
+ result = AutoCreateResult.CREATED;
+ } else {
+ // if the address doesn't exist and can't be autocreated then
return false immediately
Review Comment:
Fixed.
##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java:
##########
@@ -304,6 +304,7 @@ public void check(final SimpleString address,
if (bareQueue == null) {
ex =
ActiveMQMessageBundle.BUNDLE.userNoPermissions(session.getUsername(),
checkType, bareAddress);
} else {
+ new Exception("trace").printStackTrace();
Review Comment:
Fixing.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]