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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.megatim.apifdxweb.service.impl.camel.routes.in;
 
import com.megatim.apifdxweb.service.impl.camel.consumers.UserActionLogConsumer;
import com.megatim.apifdxweb.tools.AppContext;
import com.megatim.fdxcommons.model.log.UserActionLog;
import com.megatim.fdxcommons.tools.resolvers.JacksonMapperFormat;
import javax.enterprise.context.ApplicationScoped;
import org.apache.camel.builder.RouteBuilder;
 
/**
 *
 * @author ASUS
 */
@ApplicationScoped
public class UserActionsRoute extends RouteBuilder {
 
    @Override
    public void configure() throws Exception {
 
        from("direct:" + AppContext.API_USER_ACTION_DIRECT)
                .marshal(JacksonMapperFormat.jacksonDataFormat(UserActionLog.class))
                .to("rabbitmq:"
                        + AppContext.API_USER_ACTION_EXCHANGE
                        + "?queue=" + AppContext.API_USER_ACTION_QUEUE
                        + "&routingKey=" + AppContext.API_USER_ACTION_ROUTING_KEY
                        + "&autoDelete=false");
 
        from("rabbitmq:"
                + AppContext.API_USER_ACTION_EXCHANGE
                + "?queue=" + AppContext.API_USER_ACTION_QUEUE
                + "&routingKey=" + AppContext.API_USER_ACTION_ROUTING_KEY
                + "&autoDelete=false")
                .unmarshal(JacksonMapperFormat.jacksonDataFormat(UserActionLog.class))
                .bean(UserActionLogConsumer.class);
 
        from("direct:" + com.megatim.fdxcommons.tools.context.AppContext.USER_ACTION_TO_FDX_CONS_DIRECT)
                .marshal(JacksonMapperFormat.jacksonDataFormat(UserActionLog.class))
                .to("rabbitmq:"
                        + com.megatim.fdxcommons.tools.context.AppContext.USER_ACTION_TO_FDX_CONS_EXCHANGE
                        + "?queue=" + com.megatim.fdxcommons.tools.context.AppContext.USER_ACTION_TO_FDX_CONS_QUEUE
                        + "&routingKey=" + com.megatim.fdxcommons.tools.context.AppContext.USER_ACTION_TO_FDX_CONS_ROUTING_KEY
                        + "&autoDelete=false");
 
    }
}