Search code examples
spring-bootapache-camelmina

Configuring Camel for Spring with MINA 2


I want to configure Camel for Spring with MINA 2.

I did the following configuration code:

@Configuration
public class SpringConfiguration  { 
    public static final String THREADPOOL_ID = "poolId";

    @Bean
    CamelContextConfiguration contextConfiguration() {
        return new CamelContextConfiguration() { 

            @Override
            public void beforeApplicationStart(CamelContext context) {
                context.addComponent("mina2", new Mina2Component());
            }

            @Override
            public void afterApplicationStart(CamelContext arg0) { 
            }
        };
    }     
}

But when I wrote the router code like below. But it is not working:

@Component
public class RouteConfiguration extends RouteBuilder { 

    @Value("${app.collectorStringInput}")
    private String collectorStringInput;

    @Value("${app.mapOutputQueue}")
    private String mapOutputQueue;

    private final SiemParserProcessor parserProcessor; 

    public RouteConfiguration(SiemParserProcessor parser) { 
        this.parserProcessor = parser;
    }  

    @Override
    public void configure() throws Exception { 
        from("mina2:udp://10.31.0.32:514?disconnectOnNoReply=false&sync=false").to("log:edu.accs.siem.collector?level=DEBUG"); 
    }
}

However, I can see this lines in the log:

2018-06-30 11:37:14.270  INFO 480 --- [  restartedMain] o.a.camel.spring.SpringCamelContext      : Route: route1 started and consuming from: mina2://udp://10.31.0.32:514?disconnectOnNoReply=false&sync=false
2018-06-30 11:37:14.270  INFO 480 --- [  restartedMain] o.a.camel.spring.SpringCamelContext      : Total 1 routes, of which 1 are started
2018-06-30 11:37:14.271  INFO 480 --- [  restartedMain] o.a.camel.spring.SpringCamelContext      : Apache Camel 2.21.1 (CamelContext: camel-1) started in 0.185 seconds

It is working without using Spring. So I guess there is some configuration issue.

Can anybody tell me what I am missing?

PS: I checked out netty, but it seems not working even when not using Spring.


Solution

  • I got it working. Actually, this was processing, But somehow the logging wasn't displaying.