Skip to content
No description, website, or topics provided.
Java
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
pom.xml
readme

readme

IRC Javascript Evaluator Example
--------------------------------
Just a simple example of using camel to receive a message from an irc based endpoint, route it through the appropriate scripting engine and send the result back to the irc endpoint. 

Requires JAVA_HOME to be set to a java6 SDK. Won't work on anything else because I wrote this quick and on the fly just to learn camel.

Starting
--------
From the command line type 
 mvn compile exec:java -Dexec.mainClass=org.jamescarr.camel.Main

Usage
-----
By default it creates a bot named lang-bot and drops it in #botwar on irc.freenode.net. To test it, join irc.freenode.net/#botwar and type

?js [some javascript snippet]
or
?rb [some ruby snippet]

for example:
?js (function(n){ return n==1?n:n*arguments.callee(n-1)})(5)

Under The Hood
--------------
If you want to see all the camel magic used for this example, take a peek at ScriptSelectionRoute.java (where you can also specify the name for the bot as well). The spring configuration (irc-example.xml) is purposefully kept small and only contains the camelContext (so spring can manage it) and references to the script engines used (Because I don't know how to do it otherwise).

Have fun!
You can’t perform that action at this time.