Configuration
Prev | Chapter 36. StanzaSender | Next

## Configuration

It is Tigase component so the configuration is similar to configuration of all other components. The simplest way to get the settings for StanzaSender is by generating 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 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>

I think most of parameters should be pretty clear but some may need a little explanation. General StanzaSender parameters:

- default-interval number which specifies in seconds how often should the task look in data source for new packets to send.
- max-queue-size is a number which specifies internal packets queue size. This is used to prevent the component from consume all the memory for data in case the component can not process them.
- stanza-listeners is a list of task names to load. Each task can read XMPP packets to send from different data source. You can load as many listeners (tasks) as you need. Each task must read stanzas from different data source.

Each task has own, separate parameters list. For each task from the stanza-listeners list there is a separate section with parameters for each task:

- active boolean switch allowing you to turn on/off the task without removing configuration completely.
- class-name Java class name which implements the task. This class must extend tigase.server.ssender.SenderTask and it is loaded at runtime.
- init-string is kind of data source connection string. For database it is just database connection string, for file system this is just a directory name. It may be even different for different tasks. The 2 tasks already implemented have some specific features: FileTask allows you to use wild-chars in directory/ file name specification and JDBCTask allows you to specify additional parameter at the end of JDBC connection string - database table name. For specific examples look at above config sections.
- interval is a number which allows you to specify different interval in seconds for checking data source for each task.

Prev | Up | Next
Chapter 36. StanzaSender | Home | Chapter 37. Debuging Tigase