Created
January 28, 2010 17:40
-
-
Save kitplummer/288959 to your computer and use it in GitHub Desktop.
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
class JobRoute { | |
def configure = { | |
println "Setting JobRoute Camel Router..." | |
from("seda:job.contents"). | |
process{ exchange -> | |
String body = exchange.getIn().getBody() | |
def job = new XmlParser().parseText(body) | |
def url = "http://localhost:4567/converter/service" | |
File input = new File(job.filepath.text()) | |
def client = new HttpClient() | |
def post = new PostMethod(url) | |
post.setRequestHeader("Accept", "text/plain") | |
RequestEntity entity = new FileRequestEntity(input, job.type.text()); | |
post.setRequestEntity(entity); | |
client.executeMethod(post) | |
//println "JOD RESPONSE: #${post.getResponseBodyAsString().toString()}" | |
def text = post.getResponseBodyAsString().toString() | |
}. | |
to("bean:rawTextService?methodName=handleText") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment