Added resolve by queue name for backward compatibility
This commit is contained in:
		
							parent
							
								
									abe127c3fa
								
							
						
					
					
						commit
						fa4a20d711
					
				@ -506,6 +506,11 @@ public class ActorSystemContext {
 | 
				
			|||||||
        return partitionService.resolve(serviceType, queueId, tenantId, entityId);
 | 
					        return partitionService.resolve(serviceType, queueId, tenantId, entityId);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Deprecated
 | 
				
			||||||
 | 
					    public TopicPartitionInfo resolve(ServiceType serviceType, String queueName, TenantId tenantId, EntityId entityId) {
 | 
				
			||||||
 | 
					        return partitionService.resolve(serviceType, tenantId, entityId, queueName);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public String getServiceId() {
 | 
					    public String getServiceId() {
 | 
				
			||||||
        return serviceInfoProvider.getServiceId();
 | 
					        return serviceInfoProvider.getServiceId();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -161,6 +161,13 @@ class DefaultTbContext implements TbContext {
 | 
				
			|||||||
        enqueue(tpi, tbMsg, onFailure, onSuccess);
 | 
					        enqueue(tpi, tbMsg, onFailure, onSuccess);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    @Deprecated
 | 
				
			||||||
 | 
					    public void enqueue(TbMsg tbMsg, String queueName, Runnable onSuccess, Consumer<Throwable> onFailure) {
 | 
				
			||||||
 | 
					        TopicPartitionInfo tpi = resolvePartition(tbMsg, queueName);
 | 
				
			||||||
 | 
					        enqueue(tpi, tbMsg, onFailure, onSuccess);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void enqueue(TbMsg tbMsg, QueueId queueId, Runnable onSuccess, Consumer<Throwable> onFailure) {
 | 
					    public void enqueue(TbMsg tbMsg, QueueId queueId, Runnable onSuccess, Consumer<Throwable> onFailure) {
 | 
				
			||||||
        TopicPartitionInfo tpi = resolvePartition(tbMsg, queueId);
 | 
					        TopicPartitionInfo tpi = resolvePartition(tbMsg, queueId);
 | 
				
			||||||
@ -229,6 +236,11 @@ class DefaultTbContext implements TbContext {
 | 
				
			|||||||
        return mainCtx.resolve(ServiceType.TB_RULE_ENGINE, queueId, getTenantId(), tbMsg.getOriginator());
 | 
					        return mainCtx.resolve(ServiceType.TB_RULE_ENGINE, queueId, getTenantId(), tbMsg.getOriginator());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Deprecated
 | 
				
			||||||
 | 
					    private TopicPartitionInfo resolvePartition(TbMsg tbMsg, String queueName) {
 | 
				
			||||||
 | 
					        return mainCtx.resolve(ServiceType.TB_RULE_ENGINE, queueName, getTenantId(), tbMsg.getOriginator());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private TopicPartitionInfo resolvePartition(TbMsg tbMsg) {
 | 
					    private TopicPartitionInfo resolvePartition(TbMsg tbMsg) {
 | 
				
			||||||
        return resolvePartition(tbMsg, tbMsg.getQueueId());
 | 
					        return resolvePartition(tbMsg, tbMsg.getQueueId());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -160,6 +160,18 @@ public class HashPartitionService implements PartitionService {
 | 
				
			|||||||
        removeTenant(tenantId);
 | 
					        removeTenant(tenantId);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    @Deprecated
 | 
				
			||||||
 | 
					    public TopicPartitionInfo resolve(ServiceType serviceType, TenantId tenantId, EntityId entityId, String queueName) {
 | 
				
			||||||
 | 
					        log.warn("This method is deprecated and will be removed!!!");
 | 
				
			||||||
 | 
					        TenantId isolatedOrSystemTenantId = getIsolatedOrSystemTenantId(serviceType, tenantId);
 | 
				
			||||||
 | 
					        QueueKey queueKey = new QueueKey(serviceType, queueName, isolatedOrSystemTenantId);
 | 
				
			||||||
 | 
					        if (!partitionSizesMap.containsKey(queueKey)) {
 | 
				
			||||||
 | 
					            queueKey = new QueueKey(serviceType, isolatedOrSystemTenantId);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return resolve(queueKey, entityId);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public TopicPartitionInfo resolve(ServiceType serviceType, TenantId tenantId, EntityId entityId) {
 | 
					    public TopicPartitionInfo resolve(ServiceType serviceType, TenantId tenantId, EntityId entityId) {
 | 
				
			||||||
        return resolve(serviceType, null, tenantId, entityId);
 | 
					        return resolve(serviceType, null, tenantId, entityId);
 | 
				
			||||||
 | 
				
			|||||||
@ -32,6 +32,9 @@ import java.util.UUID;
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
public interface PartitionService {
 | 
					public interface PartitionService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Deprecated
 | 
				
			||||||
 | 
					    TopicPartitionInfo resolve(ServiceType serviceType, TenantId tenantId, EntityId entityId, String queueName);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    TopicPartitionInfo resolve(ServiceType serviceType, TenantId tenantId, EntityId entityId);
 | 
					    TopicPartitionInfo resolve(ServiceType serviceType, TenantId tenantId, EntityId entityId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    TopicPartitionInfo resolve(ServiceType serviceType, QueueId queueId, TenantId tenantId, EntityId entityId);
 | 
					    TopicPartitionInfo resolve(ServiceType serviceType, QueueId queueId, TenantId tenantId, EntityId entityId);
 | 
				
			||||||
 | 
				
			|||||||
@ -142,6 +142,9 @@ public interface TbContext {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    void output(TbMsg msg, String relationType);
 | 
					    void output(TbMsg msg, String relationType);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Deprecated
 | 
				
			||||||
 | 
					    void enqueue(TbMsg tbMsg, String queueName, Runnable onSuccess, Consumer<Throwable> onFailure);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Puts new message to custom queue for processing
 | 
					     * Puts new message to custom queue for processing
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user