package at.procon.eventhub.camel;

import at.procon.eventhub.service.TelematicsPositionEventMapper;
import org.apache.camel.builder.RouteBuilder;
import org.springframework.stereotype.Component;

@Component
public class TelematicsPositionInputRoute extends RouteBuilder {

    private final TelematicsPositionEventMapper mapper;

    public TelematicsPositionInputRoute(TelematicsPositionEventMapper mapper) {
        this.mapper = mapper;
    }

    @Override
    public void configure() {
        from("direct:telematics-position-input")
                .routeId("telematics-position-input-route")
                .split(body())
                    .bean(mapper, "map")
                    .to("direct:eventhub-normalized-input")
                .end();
    }
}
