Skip to content

Home

Introduction

Development

IDEs

Services

Service manager

API Explorer

examples package: Integrate endpoints

The examples package contains Integrate endpoints of different types for demonstrating capabilities and possible configurations.

The examples package's endpoints are configured to use the following services, which are collectively under the endpointServices package:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
examples
├── ...
└── code
    └── endpointServices
        ├── gloop
        │   ├── emailExamples
        │   │   └── ReadEmailAttachments.gloop
        │   ├── fileExamples
        │   │   ├── LogToFile.gloop
        │   │   └── SendToRemoteLocation.gloop
        │   └── ...
        └── groovy
            ├── EmailExamples.groovy
            └── ...

You will notice that each service has a Gloop and Groovy version. It is possible to configure any of the endpoints so that they call the Gloop service instead of the Groovy service or vice versa.

Try it!

The examples package's endpoints are easily accessible under the Endpoints tree item in the Coder Navigator view. See the available endpoints in action simply by enabling1 and starting them.

Some of the endpoints in the examples package need to be set up before services could be invoked. In the following sub-sections, we'll run you through the setup process of each endpoint.

Directory watcher

A Directory watcher endpoint is not available in the examples package, so you must create one yourself. For example purposes, TORO recommends you use any of the following services as the endpoint's service:

Type Service
Gloop code/endpointServices/gloop/fileExamples/SendToRemoteLocation.gloop
Groovy code/endpointServices/groovy/FileExamples.sendToRemoteLocation(byte[], String)

Either services require that you configure the FTP credentials to be used. You can do this by setting the following properties in the package.properties file:

Key Description
ftp.host FTP server host
ftp.username FTP server username
ftp.password FTP server password
ftp.protocol FTP server
Not enough time to setup your own FTP server?

There are public FTP servers like DLP Test if you want a quick way to set up an FTP server.

To trigger the endpoint, you must either add, modify, or delete a file in the directory configured for the endpoint. This all depends on which actions you have configured the endpoint to respond to.

The result of the endpoint invocation depends on the configured service. For the services above, you should expect the file that triggered the service to be sent over the FTP server.

Email

An example email endpoint is not provided out-of-the-box which is why a new endpoint of said type must be created. The following properties must also be configured:

Key Description
protocol Protocol of the SMTP server
server Host of the SMTP server
port Port of the SMTP server
login Username used for the SMTP server
password Password used for the SMTP server

TORO recommends you use any of the following services as the endpoint's service:

Type Service
Gloop code/endpointServices/gloop/emailExamples/ReadEmailAttachments.gloop
Groovy code/endpointServices/groovy/EmailExamples.readEmailAttachment()

Send service response as reply

You can easily reply to received messages via the "Send service response as reply" option. With this, the message returned by the service is sent as the response when the endpoint gets triggered by a received email.

To trigger the endpoint, send an email to the email address (account) configured for the endpoint.

The result of the endpoint invocation depends on the configured service. For the services above, you should expect the email received to be logged to the console.

FTP client

Since there is no example created by default, you must create the FTP client endpoint. You can use any of the following services as the service of the endpoint:

Type Service
Gloop code/endpointServices/gloop/FileExamples/LogToFile.gloop
Groovy code/endpointServices/groovy/FileExamples.logFileChange()

To trigger this endpoint, add, update, or delete a tracked file from the configured FTP/FTPS/SFTP server. Which action to perform depends on the type of events tracked by this endpoint.

The result of the endpoint invocation depends on the configured service. For the services above, you should expect the name of the file that triggered the service to be logged to the console.

JMS listener

The example JMS listener endpoint is already configured so all you have to do is to start the JMSListenerExample endpoint of the examples package.

You may use any of the following services as the endpoint's service:

Type Service
Gloop code/endpointServices/gloop/JMSExamples/ReceiveJMS.gloop
Groovy code/endpointServices/groovy/JMSExamples.receiveJMS(Message)

Once the JMSListenerExample endpoint is enabled and started, the JMS queue queue://exampleJMSListener becomes active. It will wait for JMS messages to be sent. The endpoint gets triggered when a message is received in said destination.

Invoke SendJMSMessage.gloop or JMSExamples.sendJMSMessage(String, String) to publish a message to the aforementioned JMS destination. Upon endpoint invocation, you should expect a log message like below:

1
04/06/19 14:05:36.811 INFO  [Integrate] Received a reply for message "Coder Studio.". The reply text is: Received message with id: ID:TORO-MBP20-49485-1559606518516-2:1:6:3:1. Message acknowledged
Durable JMS listener

Another JMS listener endpoint, called JMSListenerDurableExample, is shipped with the examples package. This endpoint demonstrates how a JMS listener endpoint with a durable subscription behaves.

RSS

The example RSS endpoint is already created and configured; you just have to enable and start the RSSExample endpoint.

You may use any of the following services as the endpoint's service. Either services log RSS entries found to the Integrate console.

Type Service
Gloop code/endpointServices/gloop/rssExamples/RssReader.gloop
Groovy code/endpointServices/groovy/RSSExamples.rssReader()

Upon starting the endpoint, the configured service will be called, and then re-invoked every n polling internal seconds. Log messages like below are expected every time the endpoint is invoked:

1
2
3
4
5
6
INFO  [RomeRunnableTrigger] Found '5' entries from RSS feed 'http://localhost:8080/api/example/server/rss?dataFormat=xml'
INFO  [Integrate] Found a new RSS item with title Title 1
INFO  [Integrate] Found a new RSS item with title Title 2
INFO  [Integrate] Found a new RSS item with title Title 3
INFO  [Integrate] Found a new RSS item with title Title 4
INFO  [Integrate] Found a new RSS item with title Title 5

Scheduler

The example Scheduler endpoint is already created in the examples package. Before enabling the Scheduler endpoint, you must first open the package.properties file and configure the email credentials. Properties required are enlisted and described in the table below:

Key Description
protocol Protocol of the SMTP server
server Host of the SMTP server
port Port of the SMTP server
login Username used for the SMTP server
password Password used for the SMTP server
email.bulk.to Comma-separated email addresses that will receive the email

After configuring these properties, you may proceed to enabling and starting the SendScheduledEmail endpoint.

Use any of the following as the endpoint's service.

Type Service
Gloop code/endpointServices/gloop/schedulerExamples/SendScheduledEmail.gloop
Groovy code/endpointServices/groovy/SchedulerExamples.sendScheduledEmail()

The endpoint will be invoked after every configured interval. And once invoked, either of the services above will send an email to the configured recipients.

Tracker resubmit

The example Tracker resubmit endpoint is already configured; all you have to do is enable and start it to see the endpoint in action. Take note that this endpoint is dependent on the RSS endpoint (RSSExample), so that endpoint has to be enabled and started as well before you can use TrackerResubmitExample.

You may use any of the following services as the endpoint's service:

Type Service
Gloop code/endpointServices/gloop/trackerResubmitExamples/Resubmit.gloop
Groovy code/endpointServices/groovy/TrackerResubmitExamples.resubmit()

Enabling this endpoint allows RSS documents of Started states2 to be resubmitted in the Tracker UI. Upon resubmitting an RSS document, you would notice a Resubmit Count property added to it.3

REST alias

The REST alias endpoint is already configured, you just have to enable and start up the RestAliasExample endpoint of the examples package.

TORO recommends you use any of the following services as this endpoint's service:

Type Service
Gloop code/endpointServices/gloop/JMSExamples/SendJMSMessage.gloop
Groovy code/endpointServices/groovy/JMSExamples.sendJMSMessage()

To trigger this endpoint, enable the JMSListener endpoint, and send a request to GET request to /api/sendJMSMessage?jmsQueue=queue://news&messageContent=Hello. You should receive a response similar to:

1
2
3
{
    "reply": "Received message with id: ID:TORO-MBP20-49419-1559692612334-2:1:9:3:3. Message acknowledged"
}

  1. You can do this by ensuring that the Auto Start checkbox is ticked. 

  2. Conditions are specified in the endpoint's configuration. 

  3. Courtesy of the configured endpoint service.