Table of Contents

Search

  1. Preface
  2. RulePoint Interfaces
  3. RulePoint Services
  4. Custom Service API
  5. Java Adapter for REST API
  6. RulePoint REST API
  7. Sample XML and JSON Requests and Responses
  8. RulePoint Pluggable Authentication Module
  9. HTTP Request and Response Attributes

Developer Guide

Developer Guide

Creating a Custom Schedulable Source Service

Creating a Custom Schedulable Source Service

  1. Create a service class that extends from the AbstractPluggableSchedulableSource abstract class.
  2. Mark the service class with the @Service annotation. Set the serviceType in @Service to ServiceType.SOURCE.
    The following code is an example of a service class that extends the AbstractPluggableSchedulableSource class:
    @Service(name="TemperatureService", displayName = "Temperature Source", description = "This is a Sample Source Service", configClassName = "com.informatica.sdk.samples.sources.SampleListenerSource", serviceType = ServiceType.SOURCE) public class TemperatureSourceService extends AbstractPluggableSchedulableSource {
  3. Implement the following lifecycle methods for the schedulable source:
    • To set the instance variables and fetch values from the properties object and configuration logic, implement the com.informatica.cep.sdk.service.AbstractSource.configure(Properties) method. You implement this method first to add a custom configuration property to the user interface. The ServiceController framework calls this method during deployment. Properties argument to the function carries all the user-provided values for the configurable properties that have a valid @ServiceProperty annotation on their getters.
      The connection attributes merged with the attributes of the source, analytic, or responder into a single Properties object are passed to the configure() method during deployment.
      The following example illustrates how to set the custom configurable property:
      private String city; @ServiceProperty( name="city", displayName="City", description="Enter the name of the city and it will return the City Temperature", propertyEditor="com.informatica.cep.shared.beans.propertyeditors.TextEditor", optional=false, order=1) public String getCity() { return city; } public void setCity(String city) { this.city = city; }
      When you configure a source, the configured property appears in the user interface.
    • To execute the service and use the MessagePublisher to publish events in the form of Map<String, Object>, implement the com.informatica.cep.sdk.Schedulable.execute() method. To publish the message, you must access the MessagePublisher by calling the getPublisher() method.
      The following is an example of the execute method implementation:
      @Override public Map<String, Object> execute() { Map<String, Object> event = new HashMap<String, Object>(); event.put("temperature", "78"); event.put("city", city); getPublisher().publishMessage(event); return null; }
    • To free the resources and undeploy the source service, implement the com.informatica.cep.sdk.Service.destroy() method. Call this method to undeploy the source. If an analytic uses a custom connection, you cannot destroy or clean up the connection. The destroy method for the connection is a part of connection undeployment.
    A new entry is created for the source type. The user interface displays the newly added source and the custom configuration property in the list on the source creation page.

0 COMMENTS

We’d like to hear from you!