com.io7m.jrai
The jrai package provides an IRC bot that can subscribe to one or more queues on a message broker (such as Apache ActiveMQ) and relay text messages to an IRC channel.
Features
- ActiveMQ → IRC text message relay bot.
- Optimized for size: Runs happily with a 16mb heap!
- OSGi-ready
- ISC license
Documentation
Documentation for the 0.0.6 release is available for reading online.
Documentation for current and older releases is archived in the repository.
User documentation
The jrai program takes a configuration file in Properties format. An example configuration file is as follows:
com.io7m.jrai.queues = exampleQueue0 exampleQueue1 com.io7m.jrai.irc_server_host = irc.example.com com.io7m.jrai.irc_server_port = 6669 com.io7m.jrai.irc_nick = jrai com.io7m.jrai.irc_user = jrai com.io7m.jrai.irc_channel = #status com.io7m.jrai.queues.exampleQueue0.broker_address = messaging.example.com com.io7m.jrai.queues.exampleQueue0.broker_port = 61000 com.io7m.jrai.queues.exampleQueue0.broker_user = alice com.io7m.jrai.queues.exampleQueue0.broker_password = bm90IGEgcGFzc3dvcmQK com.io7m.jrai.queues.exampleQueue0.queue_address = queue0 com.io7m.jrai.queues.exampleQueue1.broker_address = messaging.example.com com.io7m.jrai.queues.exampleQueue1.broker_port = 61000 com.io7m.jrai.queues.exampleQueue1.broker_user = alice com.io7m.jrai.queues.exampleQueue1.broker_password = bm90IGEgcGFzc3dvcmQK com.io7m.jrai.queues.exampleQueue1.queue_address = queue1
The com.io7m.jrai.queues property provides a space-separated list of queue definitions. The elements of the list are used to look up configuration properties for each queue by prepending the given names with com.io7m.jrai.queues.. In the above example, two queue definitions exampleQueue0 and exampleQueue1 are defined, and the queue configuration properties are given in com.io7m.jrai.queues.exampleQueue0.* and com.io7m.jrai.queues.exampleQueue1.*.
The above configuration will cause the bot to connect to irc.example.com:6669, using username jrai and nickname jrai. The bot will join the #status channel. The bot will then connect to messaging.example.com:61000 and subscribe to queues queue0 and queue1. The bot will then relay any text message sent to those queues to the #status channel.
The bot is executed with: $ java -jar jrai.jar jrai.conf, where jrai.jar is the jrai jar file, and jrai.conf is the configuration file. The bot will not fork into the background; it is designed to run under a process supervision system.
IRC Server Properties
Property | Description |
---|---|
com.io7m.jrai.irc_server_host | The IRC server hostname |
com.io7m.jrai.irc_server_port | The IRC server port |
com.io7m.jrai.irc_nick | The nickname the bot will use on the IRC server. |
com.io7m.jrai.irc_user | The username the bot will use on the IRC server. |
com.io7m.jrai.irc_channel | The channel to which the bot will join on the IRC server. |
Message Queue Properties
Property | Description |
---|---|
com.io7m.jrai.*.broker_address | The address of the message broker |
com.io7m.jrai.*.broker_port | The message broker port |
com.io7m.jrai.*.broker_user | The username that will be used when connecting to the message broker. |
com.io7m.jrai.*.broker_password | The password that will be used when connecting to the message broker. |
com.io7m.jrai.*.queue_address | The name of the queue to which the bot will subscribe on the message broker. |
Example Invocation
The following invocation runs jrai as an unprivileged user, with a custom trust store, and settings optimized for a tiny (16mb) heap:
exec /usr/bin/chpst \ -u jrai:agents \ /usr/bin/java \ -Xmx16m \ -Xms16m \ -XX:MetaspaceSize=32m \ -XX:MaxMetaspaceSize=32m \ -XX:-UseCompressedClassPointers \ -XX:TieredStopAtLevel=2 \ -XX:+UseSerialGC \ -XX:+PrintGC \ -Djavax.net.ssl.trustStore=/local/etc/jrai/trust.jks \ -Djavax.net.ssl.trustStorePassword=c3RpbGwgbm90IGEgcGFzc3dvcmQK \ -jar /local/etc/jrai/com.io7m.jrai-0.0.5-main.jar \ /local/etc/jrai/jrai.properties
Maven
The following is a complete list of the project's modules expressed as Maven dependencies:
<dependency> <groupId>com.io7m.jrai</groupId> <artifactId>com.io7m.jrai</artifactId> <version>0.0.6</version> </dependency>
Each release of the project is made available on Maven Central within ten minutes of the release announcement.
Sources
This project uses Git to manage source code.
Repository: https://github.com/io7m/jrai
$ git clone https://github.com/io7m/jrai
License
Copyright © 2020 Mark Raynsford <code@io7m.com> http://io7m.com Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Bug Tracker
The project uses GitHub Issues to track issues.