This is a component which make it easier to integrate Jabber/XMPP server with other, third-party tools.
It simply allows you to send stanzas from your application without implementing any Jabber/XMPP specific code. The component regularly reads specified data source for XMPP packets to send. The data source can be an SQL database, directory on your filesystem or anything you might want.
If you have Web application for example which you want to send notifications of any 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… it doesn’t know. To do 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 practise 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 single stanza to send and any entry in database table can also contain only single stanza to send. File on hard disk and record in database is deleted after it is read.
Any file in 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 looks for *.stanza files in /var/spool/jabber/ folder but you can specify different directory name in initialization string. 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 assmes 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" attriutes.
By default it looks for stanzas in xmpp_stanza table but you can specify different table name in connection string. Sample connection string:
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.