Available as of Camel Extra 2.11
The rcode component supports the integration of the statistics environment R via Rserve
There are several operations available to integrate Java with R. The current component has implemented the following subset of operations:
Assigns a string value to a symbol in R. The symbol is created if it does not already exist. An exchange object passed to an endpoint configured with the assign_content operation must contain an objet of type Entry<String,String> where the first String denotes the symbol name and the second contains the value.
Assigns a content of a R Expression (REXP) to a symbol in R. The assignment of the symbol takes place when passing an object of type Entry<String,REXP> via the message exchange.
Evaluates a given R command and retrieves the result. The R command is transported as String object via the exchange.
Parses and evaluates a given R command and retrieves the result. The R command is transported as String object via the exchange.
Evaluates a given R command, but does not fetch the result. The R command is passed as String object within the exchange. This operation is useful for assignments or for plots having a defined file as output.
The following example should clarify the component's interaction style:
Configuring an endpoint that evaluates a given R command.
Sending an R command to the endpoint. For a full list of possible command, please refer to the R Language Definition
template.sendBody("direct:rcode", "c <- sqrt(2^2 + 2^2);");
Configures the username to authenticate secured Rserve instances
Adds the password to the endpoint to access a secured R environment
Defines the buffer size for the transport between Rserve and the rcode component. The lowest possible value is 32KB, the highest value is at 1GB. Both values are bound to the available RAM.