Minor refactoring for notifications consumers
This commit is contained in:
		
							parent
							
								
									15d189ead7
								
							
						
					
					
						commit
						b16d8484e9
					
				@ -85,7 +85,7 @@ public abstract class AbstractConsumerService<N extends com.google.protobuf.Gene
 | 
			
		||||
        this.scheduler = Executors.newSingleThreadScheduledExecutor(ThingsBoardThreadFactory.forName(prefix + "-consumer-scheduler"));
 | 
			
		||||
 | 
			
		||||
        this.nfConsumer = QueueConsumerManager.<TbProtoQueueMsg<N>>builder()
 | 
			
		||||
                .name("TB Notifications")
 | 
			
		||||
                .name(getServiceType().getLabel() + " Notifications")
 | 
			
		||||
                .msgPackProcessor(this::processNotifications)
 | 
			
		||||
                .pollInterval(getNotificationPollDuration())
 | 
			
		||||
                .consumerCreator(this::createNotificationsConsumer)
 | 
			
		||||
 | 
			
		||||
@ -15,11 +15,23 @@
 | 
			
		||||
 */
 | 
			
		||||
package org.thingsboard.server.common.msg.queue;
 | 
			
		||||
 | 
			
		||||
import lombok.Getter;
 | 
			
		||||
import lombok.RequiredArgsConstructor;
 | 
			
		||||
 | 
			
		||||
@RequiredArgsConstructor
 | 
			
		||||
@Getter
 | 
			
		||||
public enum ServiceType {
 | 
			
		||||
 | 
			
		||||
    TB_CORE, TB_RULE_ENGINE, TB_TRANSPORT, JS_EXECUTOR, TB_VC_EXECUTOR;
 | 
			
		||||
    TB_CORE("TB Core"),
 | 
			
		||||
    TB_RULE_ENGINE("TB Rule Engine"),
 | 
			
		||||
    TB_TRANSPORT("TB Transport"),
 | 
			
		||||
    JS_EXECUTOR("JS Executor"),
 | 
			
		||||
    TB_VC_EXECUTOR("TB VC Executor");
 | 
			
		||||
 | 
			
		||||
    private final String label;
 | 
			
		||||
 | 
			
		||||
    public static ServiceType of(String serviceType) {
 | 
			
		||||
        return ServiceType.valueOf(serviceType.replace("-", "_").toUpperCase());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user