Use system queue with same name instead of Main when missing
This commit is contained in:
parent
2fef3858a3
commit
bfd8ff934f
@ -186,7 +186,8 @@ public class HashPartitionService implements PartitionService {
|
||||
TenantId isolatedOrSystemTenantId = getIsolatedOrSystemTenantId(serviceType, tenantId);
|
||||
QueueKey queueKey = new QueueKey(serviceType, queueName, isolatedOrSystemTenantId);
|
||||
if (!partitionSizesMap.containsKey(queueKey)) {
|
||||
queueKey = new QueueKey(serviceType, isolatedOrSystemTenantId);
|
||||
// TODO: fallback to Main in case no system queue
|
||||
queueKey = new QueueKey(serviceType, queueName, TenantId.SYS_TENANT_ID);
|
||||
}
|
||||
return resolve(queueKey, entityId);
|
||||
}
|
||||
@ -207,6 +208,9 @@ public class HashPartitionService implements PartitionService {
|
||||
.putLong(entityId.getId().getLeastSignificantBits()).hash().asInt();
|
||||
|
||||
Integer partitionSize = partitionSizesMap.get(queueKey);
|
||||
// if (partitionSize == null) {
|
||||
// throw new IllegalStateException("Can't get partition ")
|
||||
// }
|
||||
int partition = Math.abs(hash % partitionSize);
|
||||
|
||||
return buildTopicPartitionInfo(queueKey, partition);
|
||||
|
||||
@ -187,17 +187,6 @@ public abstract class BaseTenantProfileServiceTest extends AbstractServiceTest {
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSaveSameTenantProfileWithDifferentIsolatedTbRuleEngine() {
|
||||
TenantProfile tenantProfile = this.createTenantProfile("Tenant Profile");
|
||||
TenantProfile savedTenantProfile = tenantProfileService.saveTenantProfile(TenantId.SYS_TENANT_ID, tenantProfile);
|
||||
savedTenantProfile.setIsolatedTbRuleEngine(true);
|
||||
addMainQueueConfig(savedTenantProfile);
|
||||
Assertions.assertThrows(DataValidationException.class, () -> {
|
||||
tenantProfileService.saveTenantProfile(TenantId.SYS_TENANT_ID, savedTenantProfile);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteTenantProfileWithExistingTenant() {
|
||||
TenantProfile tenantProfile = this.createTenantProfile("Tenant Profile");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user