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
package com.megatim.apifdxweb.service.impl.camel.routes.in;
 
import com.megatim.apifdxweb.service.impl.camel.consumers.ApiTokenMessageConsumer;
import com.megatim.fdxcommons.model.jms.messages.ApiTokenMessage;
import com.megatim.fdxcommons.tools.CommonAppContext;
import com.megatim.fdxcommons.tools.resolvers.JacksonMapperFormat;
import javax.enterprise.context.ApplicationScoped;
import org.apache.camel.builder.RouteBuilder;
 
/**
 *
 * @author ASUS
 */
@ApplicationScoped
public class TokenAuthentificationRoute extends RouteBuilder {
 
    @Override
    public void configure() throws Exception {
 
        onException(Exception.class)
                .process(exchange -> {
                    exchange.getException().printStackTrace();
                })
                .handled(true);
 
        from("rabbitmq:"
                + CommonAppContext.TOKEN_GENERATION_EXCHANGE
                + "?queue=" + CommonAppContext.TOKEN_GENERATION_QUEUE
                + "&routingKey=" + CommonAppContext.TOKEN_GENERATION_ROUTING_KEY
                + "&autoDelete=false")
                .transacted()
                .unmarshal(JacksonMapperFormat.jacksonDataFormat(ApiTokenMessage.class))
                .bean(ApiTokenMessageConsumer.class);
 
    }
}