package sanchez.sergio.handlers;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sanchez.sergio.messages.admin.UsersManadgementMessage;

/**
 * @author sergio
 */
@Component("adminHandler")
public class AdminHandler {
    
    private static Logger logger = LoggerFactory.getLogger(AdminHandler.class);
    
    @RabbitListener(queues="#{rabbitCustomProperties.adminExchange.queues['users'].name}")
    public void handleMessage(@Payload UsersManadgementMessage message) {
        logger.info("Message -> " + message);
    }
}

@@ -333,16 +333,107 @@
 essage;%0D
+%0Aimport sanchez.sergio.messages.admin.UsersManadgementMessageType.UsersManadgementVisitor;%0D
 %0A%0D%0A/**%0D%0A
@@ -510,16 +510,51 @@
 Handler 
+implements UsersManadgementVisitor 
 %7B%0D%0A    %0D
@@ -851,22 +851,434 @@
  message);%0D%0A
+        message.getType().accept(this, message.getId());%0D%0A    %7D%0D%0A%0D%0A    @Override%0D%0A    public void visitUserConnected(Long idUser) %7B%0D%0A        logger.info(%22Declare new queue for user: %22 + idUser );%0D%0A    %7D%0D%0A%0D%0A    @Override%0D%0A    public void visitUserDisconnected(Long idUser) %7B%0D%0A        throw new UnsupportedOperationException(%22Not supported yet.%22); //To change body of generated methods, choose Tools %7C Templates.%0D%0A
     %7D%0D%0A%7D%0D%0A

implement UsersManadgementVisitor on AdminHandler