Skip to content

Home

Development

IDEs

API Explorer

Releases

Release notes

Martini Runtime

Martini Desktop

Martini Online

Feature requests

Bug reports

RSS endpoint

The RSS endpoint enables developers to write applications that invoke a configured service when changes occur in an RSS feed.

Properties

General configuration

Property Default Description
Name (required) The name of the endpoint.
Service (required) The service to execute when the endpoint is triggered.
Run As Anonymous The user to run the service in behalf of. This is logged to Tracker.
Document Type <Name of endpoint type> The document type to be used when adding documents to Tracker as this endpoint is triggered.
Auto Start true Whether or not to automatically start the endpoint upon package startup.
Log To Tracker false Flag determining whether executions should be logged to Tracker.

RSS-specific configuration

Property Default Description
URL (required) The URL hosting the RSS feed.
Polling Interval (required) The interval in seconds, at which Martini checks for changes in the RSS feed.
Only New Entries false When checked, only 'unread' entries in the RSS feed will be sent to the service.

Service

When the endpoint is triggered, the following variables are exposed to the configured service:

General parameters

Name Type Description
internalId java.lang.String The Tracker document internal ID. If the endpoint was configured to not track, this value will be null.
$trackerId java.lang.String An alias for the internalId property.
martiniPackage MartiniPackage The Martini package that contains the endpoint.
parameters java.util.Map A map containing all the endpoint specific parameters.
properties java.util.Map A map containing containing all the properties associated with the endpoint.

RSS-specific parameters

Name Gloop Object Description
context GloopObjectObject (org.quartz.JobExecutionContext) The Quartz context.
jobDataMap GloopObjectObject (org.quartz.JobDataMap) The Quartz job data map.
job GloopObjectObject (org.quartz.Job) The Quartz job.
feed io.toro.martini.rss.Feed The Model containing the RSS feed.
entries io.toro.martini.rss.Entry[] The list of entries in the RSS feed.
entry io.toro.martini.rss.Entry The newest entry in the feed.
Name Type Description
context org.quartz.JobExecutionContext The Quartz context.
jobDataMap org.quartz.JobDataMap The Quartz job data map.
job org.quartz.Job The Quartz job.
feed SyndFeed The object containing the RSS feed.
entries List<SyndEntry> The list of entries in the RSS feed.
entry SyndEntry The newest entry in the feed.

Example

Gloop as service

Consider the following input of a Gloop service:

RSS-reading service input

We can write an application that prints the contents of the RSS feed that triggered the endpoint:

RSS-reading service

  • (1) This line will iterate over the entries.
  • (2) Every item is printed using the logger.

Groovy script as service

Consider this Groovy script that simply prints the available variables in the context:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
[
    'parameters',
    'martiniPackage',
    'properties',
    'context',
    'jobDataMap',
    'job',
    'feed',
    'entries',
    'entry',
    'internalId' ].each {

    println "$it\t : " + this[it]
}

When the endpoint is triggered - in this case, the polling interval has elapsed - the console will show logs similar to the following:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
parameters   : [ <omitted> ]
martiniPackage   : martiniPackage [name=examples]
properties   : [runAs:, schedule:repeating:120, documentType:RSS, onlyNew:false, track:false,... <omitted>]
context  : JobExecutionContext: <omitted>
jobDataMap   : [ <omitted> ]
job  : io.toro.martini.core.endpoint.impl.rss.RSSJobWrapper@7151d1f6
feed     : <omitted>
entries : [ <omitted> ]
entry : <omitted>
internalId : null

Groovy method as service

We can also use a method from a Groovy class, and use the available properties as method parameters:

1
2
3
4
5
6
7
8
class RSSExamples {

    void read( def entries ) {
        entries.each {
            "Found a new RSS item with title ${it.title}".info()
        }
    }
}

This iterates the list of SyndEntry provided by the entries variable and prints the title with the logger.

Want more examples?

The distribution ships with a Martini package called examples, which contains services demonstrating more use cases.