Skip to content

Instantly share code, notes, and snippets.

@tjsnell
Created March 3, 2014 14:04
Show Gist options
  • Save tjsnell/9325570 to your computer and use it in GitHub Desktop.
Save tjsnell/9325570 to your computer and use it in GitHub Desktop.
public void configure() throws Exception {
from("cxfrs:http://0.0.0.0:9090?resourceClasses=cc.notsoclever.examples.CompanyService&bindingStyle=SimpleConsumer")
.choice()
.when(header("operationName").isEqualTo("getCompany"))
.to("sql:SELECT * from company where id = :#id")
.when(header("operationName").isEqualTo("createCompany"))
.to("sql:INSERT INTO company(name, symbol) VALUES (:#name, :#symbol)")
.when(header("operationName").isEqualTo("getCompanies"))
.to("sql:select * from company")
.when(header("operationName").isEqualTo("updateCompany"))
.to("sql:UPDATE company SET name = :#name, symbol = :#symbol where id = :#id")
.when(header("operationName").isEqualTo("deleteCompany"))
.to("sql:DELETE FROM company where id = :#id")
.end()
.marshal().json(JsonLibrary.Jackson);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment