camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guillaume Nodet <gno...@gmail.com>
Subject JIRA notifications on irc
Date Thu, 08 Oct 2009 13:40:09 GMT
FWIW, I've set up a small mail -> irc bot notification.
The camel code looks like:

    <camelContext xmlns="http://camel.apache.org/schema/spring">
        <route>
            <from
uri="imaps://imap.gmail.com:993?username=apache.ircbot@gmail.com&amp;password=xxxx&amp;consumer.delay=500&amp;delete=false"
/>
            <convertBodyTo type="java.lang.String"/>
            <setBody>
                <mvel>
                    request.headers.from.replaceAll(".*\"(.*)\".*", "$1")
                                        .replace("(JIRA)", "")
                        + request.headers.subject.replace("[jira]", "")
                </mvel>
            </setBody>
            <choice>
                <when>

<mvel>request.headers.subject.matches(".*jira.*CAMEL-.*") ==
true</mvel>
                    <setHeader
headerName="irc.target"><constant>#camel</constant></setHeader>
                </when>
                <when>

<mvel>request.headers.subject.matches(".*jira.*CXF-.*") == true</mvel>
                    <setHeader
headerName="irc.target"><constant>#cxf</constant></setHeader>
                </when>
                <when>

<mvel>request.headers.subject.matches(".*jira.*SMX-.*") == true</mvel>
                    <setHeader
headerName="irc.target"><constant>#servicemix</constant></setHeader>
                </when>
                <when>

<mvel>request.headers.subject.matches(".*jira.*AMQ-.*") == true</mvel>
                    <setHeader
headerName="irc.target"><constant>#activemq</constant></setHeader>
                </when>
                <otherwise>
                    <setBody><mvel>request.headers.from + ": " +
request.headers.subject</mvel></setBody>
                    <setHeader
headerName="irc.target"><constant>#jirabot.test</constant></setHeader>
                </otherwise>
            </choice>
            <to
uri="irc:irc.codehaus.org/?nickname=jirabot&amp;username=jirabot" />
        </route>
    </camelContext>


FWIW, I had troubles setting up the routing logic with the irc
component, because the irc component sends to all connected channels
by default, which looks a bit weird.

-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Mime
View raw message