Adding configurable parameters to a service

For a simple service, such as the one we just wrote, there is only one parameter that can be configured - the schedule at which the service runs! But what if we need to add more parameters? Let's say we want to add the tutorial name in the service, which can be changed later if needed.

How to do it...

The following are the steps required:

  1. Modify the service configuration XML to include the configurable properties:
            <someservice id="jtricksserviceid">
                <description>My New Service</description>
                <properties>
                    <property>
                        <key>Tutorial</key>
                        <name>The tutorial you like</name>
                        <type>string</type>
                    </property>
                </properties>
            </someservice>

    Here, we have added a string property with the key: Tutorial.

  2. Override theinit ...

Get JIRA Development Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.