package de.thpeetz.kontor.integration.routes;

import de.thpeetz.kontor.integration.services.AddLinkProcessor;
import de.thpeetz.kontor.media.services.MediaFileService;
import org.apache.camel.builder.RouteBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class AddLinkFromQueue extends RouteBuilder {

    @Autowired
    private final MediaFileService mediaFileService;

    @Autowired
    public AddLinkFromQueue(MediaFileService mediaFileService) {
        this.mediaFileService = mediaFileService;
    }

    @Override
    public void configure() throws Exception {
        from("jms:queue:add_link_file")
                .routeId("read-queue-add-link_file")
                .log("${body}")
                .process(new AddLinkProcessor(mediaFileService))
                .to("jms:queue:update_title");
    }
}
