Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
camel_notes [2017/06/16 08:06]
root [Getting Started]
camel_notes [2017/06/16 08:09] (current)
root [Getting Started]
Line 34: Line 34:
 </​code>​ </​code>​
  
 +== Invoking Beans ==
  
 +<code java>
 +class UpperCaseTextService {
 +    def String transform(String text) {
 +        return text.toUpperCase()
 +    }
 +}
 +def jndiContext = new JndiContext();​
 +jndiContext.bind("​upperCaseTextService",​ new UpperCaseTextService())
 +
 +def dataDir = "/​${System.properties['​user.home'​]}/​test/​file-poller-demo"​
 +def camelContext = new DefaultCamelContext(jndiContext)
 +camelContext.addRoutes(new RouteBuilder() {
 +    def void configure() {
 +        from("​file://​${dataDir}/​in"​)
 +            .to("​log://​camelLogger"​)
 +            .to("​bean://​upperCaseTextService?​method=transform"​)
 +            .to("​file://​${dataDir}/​out"​)
 +    }
 +})
 +camelContext.start()
 +
 +addShutdownHook{ camelContext.stop() }
 +synchronized(this){ this.wait() }
 +</​code>​
 == Camel and gmail ==  == Camel and gmail == 
  
 
camel_notes.txt · Last modified: 2017/06/16 08:09 by root
 
RSS - 200 © CrosswireDigitialMedia Ltd