Created
June 16, 2015 15:43
-
-
Save iocanel/4d8cb3f91a81fdc16f4d to your computer and use it in GitHub Desktop.
Route builder with cdi and fabric8 annotations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io.fabric8.annotations.Alias; | |
import io.fabric8.annotations.ServiceName; | |
import org.apache.camel.builder.RouteBuilder; | |
import org.apache.camel.cdi.ContextName; | |
import org.apache.camel.model.language.ConstantExpression; | |
import javax.ejb.Startup; | |
import javax.enterprise.context.ApplicationScoped; | |
import javax.inject.Inject; | |
import javax.sql.DataSource; | |
@ContextName("myCdiCamelContext") | |
@Startup | |
@ApplicationScoped | |
public class MyRoutes extends RouteBuilder { | |
@Inject | |
@ServiceName("mysql-service") | |
@Alias("customerds") | |
DataSource dataSource; | |
@Override | |
public void configure() throws Exception { | |
from("jetty:http://0.0.0.0:8080/list/") | |
.setBody(new ConstantExpression("select * from customers")) | |
.to("jdbc:customerds"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment