Table of Contents
A detailed description of all the configuration options is in the init.properties guide where you can also find information described below and much more. The purpose of this document is to give you a brief introduction on how to load a component into Tigase server without the need to dig through all the details.
The only step is to tell the server what components to load, how to name them and optionally give some extra parameters. To do so open the init.properties file you use in your installation.
Let’s say you want to just add PubSub for now. All you need to do is add 2 lines to the properties file:
The first line contains the component name 'pubsub' and the main class for this component is: 'tigase.pubsub.PubSubClusterComponent'. It doesn’t really matter what the component name is, the only requirement is that it must be unique among other components names. Because you can load many components, it helps to provide descriptive names thus 'pubsub' is a good name for a 'PubSub' component.
You can of course add more components, even PubSub components to the same server. Just remember that each of them would need to have a different name then. For example:
Although this may be rare, it allows for wide compatibility and platform stability.
Normally, however we want to load few different components like PubSub, MUC, MSN Transport and so on…. Therefore instead of the above second PubSub we can load the MUC component:
Changes to the init.properties file will take effect upon server restart.
StanzaSender is a component which makes it easier to integrate XMPP server with other third-party tools.
It simply allows you to send stanzas from your application without implementing any XMPP specific code. The component regularly reads specified data source for XMPP packets to send. The data source can be a SQL database, directory on your filesystem, or anything you might want.
If you have a Web application for example for which you want to send notifications of an event to selected users you can install StanzaSender component on your Tigase server. It will help you to easily distribute your messages to end-users.
The module itself doesn’t do anything, it just schedules tasks and sends stanzas which come from anywhere. To do the actual work of retrieving stanzas from data source the component uses tasks.
In theory the task can retrieve XMPP packets for sending from any location or may just generate stanzas on its own.
In practice there are 2 tasks already implemented and ready to use. You can treat them as a sample code for implementation of your own tasks customised for your specific needs or you can just use these tasks as they are.
The tasks which are available are:
FileTask implements tasks for cyclic retrieving stanzas from a directory and sending them to the StanzaHandler object.
It looks for any new stanza to send. Any single file can contain only a single stanza to send and any entry in database table can also contain only a single stanza to send. Files on hard disk and records in databases are deleted after it is read.
Any file in a given directory is treated the same way - Tigase assumes it contains valid XML data with XMPP stanza to send. You can however set in configuration, using wildchars which files contain stanzas. All stanzas must contain complete data including correct "from" and "to" attributes.
By default it is looking for *.stanza files in /var/spool/jabber/ folder but you can specify different directory names in the initialization string. Here is a sample initialization strings:
The last is equal to:
Note the last forward slash '/' is required in such case if the last element of the path is a directory.
Please note! Tigase must have writing permissions for this directory, otherwise it may not function properly.
JDBCTask implements tasks for cyclic retrieving stanzas from database and sending them to the StanzaHandler object.
Database table format:
Any record in this table is treated the same way - Tigase assumes it contains valid XML data with XMPP stanza to send. No other data are allowed in this table. All stanzas must be complete including correct "from" and "to" attributes.
By default it is looking for stanzas in xmpp_stanza table, but you can specify a different table name in the connection string. For example:
Please note the last parameter which is specific to JDBCTask. You can specify the table name which stores stanzas for sending, if omitted default value is: xmpp_stanza.
StanzaSender is a Tigase component so the configuration is similar to that of all other components. The simplest way to get the settings for StanzaSender is by generating a configuration with all possible components. To do this you have to run Tigase server with --gen-config-all parameter set.
By default this component name is ssend and here is a content of the configuration file for StanzaSender:
It is one of msg-receivers:
<entry type="String" key="id-names"> ... <item value="ssend"/> </entry>
To activate the component and a specify class name for it following entries has been added:
<entry value="true" type="Boolean" key="ssend.active"/> <entry value="tigase.server.ssender.StanzaSender" type="String" key="ssend.class"/>
And the main settings section for the component:
<component name="ssend"> <map> <entry value="10" type="Long" key="default-interval"/> <entry value="1000" type="Integer" key="max-queue-size"/> <entry type="String" key="stanza-listeners"> <item value="jdbc"/> <item value="file"/> </entry> </map> <node name="file"> <map> <entry value="true" type="Boolean" key="active"/> <entry value="tigase.server.ssender.FileTask" type="String" key="class-name"/> <entry value="/var/spool/jabber/*.stanza" type="String" key="init-string"/> <entry value="10" type="Long" key="interval"/> </map> </node> <node name="jdbc"> <map> <entry value="true" type="Boolean" key="active"/> <entry value="tigase.server.ssender.JDBCTask" type="String" key="class-name"/> <entry value="jdbc:mysql://localhost/tigase?user=tigase& password=mypass&table=xmpp_stanza" type="String" key="init-string"/> <entry value="10" type="Long" key="interval"/> </map> </node> </component>
Most parameters should be pretty clear but some may need a little explanation.
For each task from the stanza-listeners list there is a separate section with parameters for each task:
NOTE: Each task has own separate parameters list.