Kenmegne
7 days ago 23a46b4be35277e06ec89f48730eeb694e686be8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.megatim.fdxconsultation.service.impl.camel.consumer;
 
import org.apache.camel.Handler;
import com.fdx.messaging.common.StandaloneServerState;
import com.megatim.fdxconsultation.core.ifaces.supervision.StandaloneServerStateEntityManager;
import com.megatim.fdxconsultation.model.supervision.StandaloneServerStateEntity;
import com.megatim.fdxconsultation.service.impl.sockets.helpers.StandaloneServerStateSessionHandler;
import javax.inject.Inject;
import javax.transaction.Transactional;
 
/**
 *
 * @author ASUS
 */
public class StandaloneServerStateConsumer {
 
    @Inject
    StandaloneServerStateEntityManager serverStateManager;
    
    @Inject
    private StandaloneServerStateSessionHandler standaloneServerStateSessionHandler;
 
    @Handler
    @Transactional
    public void consume(StandaloneServerState serverState) {
        StandaloneServerStateEntity standaloneServerStateEntity = serverStateManager.persistStandaloneConfigurationStateEntity(serverState);
        if(standaloneServerStateEntity != null) {
            standaloneServerStateSessionHandler.publishMessage(standaloneServerStateEntity);
        }
    }
}