2010年12月17日 星期五

send message to my gtalk

quoted from

http://www.andrejkoelewijn.com/wp/2009/02/28/groovy-and-grape-easiest-way-to-send-gtalk-message-with-apache-camel/

INSTALL GROOVY AND add $HOME/.groovy/grapeConfig.xml file first. (get grapeConfig.xml from above URL)


#!/usr/local/groovy-1.6.0/bin/groovy

import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.language.groovy.GroovyRouteBuilder;

@Grab(group='org.apache.camel', module='camel-groovy', version='1.6.0')
@Grab(group='org.apache.camel', module='camel-xmpp', version='1.6.0')
@Grab(group='org.apache.camel', module='camel-core', version='1.6.0')
class SampleRoute extends GroovyRouteBuilder {
protected void configure(){
from("file:///tmp/jabber").
to("xmpp://talk.google.com:5222/mingderwang@gmail.com?serviceName=gmail.com&user=yourname&password=secrect");
}
}

def camelCtx = new DefaultCamelContext()
camelCtx.addRoutes(new SampleRoute());
camelCtx.start();

1 則留言:

  1. Pre-requirement:

    1. Install groovy (on Ubuntu)
    sudo apt-get install groovy

    2. Add Grape configuration (on Ubuntu)
    add grapeConfig.xml file under ~/.groovy/

    with contents as follows;

    回覆刪除