Examples of Specific Feed Types

This section provides examples of specific steps required when developing different feed types.

Creating up-front scheduled feeds requires additional steps. You must complete the following tasks when creating up-front scheduled feeds:

  1. Ensure that the service operation you use to publish the up-front feed messages to the Integration Broker queues satisfies these conditions:

    • It must be an asynchronous, one-way service operation.

    • It must have PT_FEED_REQUEST.VERSION_1 as the message.

    • It must be secured appropriately. This security is enforced by the scheduled feed GetFeed service operation handler at run time.

    • The queue used in the service operation must have the Archive option enabled if the up-front feeds are to be archived. If this option is not enabled, then the Archival Feeds will delete the feed messages in the Integration Broker queue.

  2. List the service operation used to publish the up-front feed messages in the Define Feed Data Types page. The system uses this information to archive feeds.

  3. Set the feed format and language as message attributes before publishing the message:

     /* Set the feed format of the message (i.e. Atom 1.0). */
    &succeeded = &responseMsg.IBInfo.AddAttribute(&feedFactory.Utility.QUERYPARAMETER_FEEDFORMAT, &feedDoc.FeedFormat);
    
    /* Set the language of the message. */
    &succeeded = &responseMsg.IBInfo.AddAttribute(&feedFactory.Utility.QUERYPARAMETER_LANGUAGE, %Language);
    
  4. Define the DSPARAMETER_MAXROW, DSPARAMETER_SF_PAGING, DSPARAMETER_INCREMENTAL, and DSPARAMETER_SF_MAXMINUTES data source parameters found in the PTFP_FEED:UTILITY:Utility application class and set them to appropriate values in your implementation of the processSettingsChange method for your data source. The system requires DSPARAMETER_MAXROW and DSPARAMETER_SF_MAXMINUTES for archiving feeds and it uses DSPARAMETER_SF_PAGING for paged feeds and DSPARAMETER_INCREMENTAL for incremental feeds.

    For example:

    &thisDSP = %This.addParameter(&utility.DSPARAMETER_MAXROW, String(&utility.SF_MAXROWOPTION_LATESTMSG));
    &thisDSP.Name = &thisDSP.ID;
    &thisDSP.Description = MsgGetText(219, 3005, "Message Not Found - Max Entries");
    &thisDSP.FieldType = &utility.FIELDTYPE_NUMBER;
    &thisDSP.DefaultValue = String(&utility.SF_MAXROWOPTION_LATESTMSG);
    &thisDSP.Value = &thisDSP.DefaultValue;
    &thisDSP.Required = True;
    
    &thisDSP = %This.addParameter(&utility.DSPARAMETER_SF_PAGING, String(&utility.SF_PAGINGOPTION_NOPAGING));
    &thisDSP.Name = &thisDSP.ID;
    &thisDSP.Description = MsgGetText(219, 3006, "Message Not Found - Paging");
    &thisDSP.FieldType = &utility.FIELDTYPE_SIGNEDNUMBER;
    &thisDSP.DefaultValue = String(&utility.SF_PAGINGOPTION_NOPAGING);
    &thisDSP.Value = &thisDSP.DefaultValue;
    &thisDSP.Required = True;
    
    &thisDSP = %This.addParameter(&utility.DSPARAMETER_INCREMENTAL, String(&utility.INCREMENTALOPTION_NO));
    &thisDSP.Name = &thisDSP.ID;
    &thisDSP.Description = MsgGetText(219, 3008, "Message Not Found - Incremental");
    &thisDSP.FieldType = &utility.FIELDTYPE_SIGNEDNUMBER;
    &thisDSP.DefaultValue = String(&utility.INCREMENTALOPTION_NO);
    &thisDSP.Value = &thisDSP.DefaultValue;
    &thisDSP.Required = True;
    
    &thisDSP = %This.addParameter(&utility.DSPARAMETER_SF_MAXMINUTES, String(&utility.SF_MAXMINUTES_ALLMSGS));
    &thisDSP.Name = &thisDSP.ID;
    &thisDSP.Description = MsgGetText(219, 3007, "Message Not Found - Max Min");
    &thisDSP.FieldType = &utility.FIELDTYPE_SIGNEDNUMBER;
    &thisDSP.DefaultValue = String(&utility.SF_MAXMINUTES_ALLMSGS);
    &thisDSP.Value = &thisDSP.DefaultValue;
    &thisDSP.Required = True;
    

    Important! The incremental feed option is incompatible with the paged feed option. Do not allow both options to be set simultaneously.

  5. Modify the associated advanced feed options page to allow feed administrators the ability to set these options.

Creating real-time incremental feeds also requires additional steps. You must complete the following tasks when creating real-time incremental feeds:

  1. Define the DSPARAMETER_INCREMENTAL data source parameter found in the PTFP_FEED:UTILITY:Utility application class and set it to an appropriate value in your implementation of the processSettingsChange method for your data source :

    &thisDSP = %This.addParameter(&utility.DSPARAMETER_INCREMENTAL, String(&utility.INCREMENTALOPTION_NO));
    &thisDSP.Name = &thisDSP.ID;
    &thisDSP.Description = MsgGetText(219, 3008, "Message Not Found - Incremental");
    &thisDSP.FieldType = &utility.FIELDTYPE_SIGNEDNUMBER;
    &thisDSP.DefaultValue = String(&utility.INCREMENTALOPTION_NO);
    &thisDSP.Value = &thisDSP.DefaultValue;
    &thisDSP.Required = True;
    

    Important! The incremental feed option is incompatible with the paged feed option. Do not allow both options to be set simultaneously.

  2. Modify the associated advanced feed options page to allow feed administrators the ability to set this option.

  3. Generate delta feed entries in your implementation of the execute method for your data source based on the QUERYPARAMETER_IFMODIFIEDSINCE query parameter of the PTFP_FEED:UTILITY:Utility application class.

    Your implementation of the execute method must contain both the QUERYPARAMETER_IFNONEMATCH and the QUERYPARAMETER_IFMODIFIEDSINCE query parameters. QUERYPARAMETER_IFNONEMATCH is the feed ID and QUERYPARAMETER_IFMODIFIEDSINCE is the time at which the feed was last requested.

    The following code excerpt shows how to get the QUERYPARAMETER_IFNONEMATCH and QUERYPARAMETER_IFMODIFIEDSINCE query parameters using RequestInfo in the execute method of the data source:

    Local PTFP_FEED:DataSource:DataSourceParameter &thisDSP;
    Local string &ifNoneMatch, &ifModifiedSince, &select;
    Local datetime &lastmodified_dt = DateTime6(1900, 1, 1, 0, 0, 0);
    Local boolean &incremental;
    
    /* Get the Incremental Parameter */
    &thisDSP = %This.getParameterById(&utility.DSPARAMETER_INCREMENTAL);
    If &thisDSP <> Null And
    (&thisDSP.EvaluatedValue = String(&utility.INCREMENTALOPTION_YES)) Then
       &incremental = True;
    Else
       &incremental = False;
    End-If;
    
    &ifNoneMatch = &utility.RequestInfo.getParameter(&utility.QUERYPARAMETER_IFNONEMATCH);
    &ifModifiedSince = &utility.RequestInfo.getParameter(&utility.QUERYPARAMETER_IFMODIFIEDSINCE);
    If All(&ifModifiedSince) Then
       &lastmodified_dt = &utility.httpStringToDatetime(&ifModifiedSince);
    End-If;
      
    /* Compare and verify that &ifNoneMatch is same as the feed ID            */ 
    
    /* Compare the &lastmodified_dt with appropriate datetime column like the */
    /* LASTUPDDTTM field in the record used for generating the feed entries   */
    
  4. When the execute method of a data source returns no feed entries, the Feed Publishing Framework issues a 304-Not Modified HTTP header. If you are using a custom feed handler—that is, a service operation different from the PTFP_GETFEED service operation —then use the setMessageHeadersAndMimeType method to set HTTP conditional headers.

    For example:

    method OnRequest
       /+ &pRequestMsg as Message +/
       /+ Returns Message +/
       /+ Extends/implements PS_PT:Integration:IRequestHandler.OnRequest +/
       
       Local Message &responseMsg;
       Local XmlDoc &xmlDoc;
       Local string &temp, &errorText;
       
       Local PTFP_FEED:UTILITY:Utility &utility = &feedFactory_inst.Utility;
       Local PTFP_FEED:XML_FEED:FeedDoc &feedDoc;
       Local PTFP_FEED:UTILITY:FeedRequest &request;
    
       /* Ccreate the Search Request object */
       &request = create PTFP_FEED:UTILITY:FeedRequest("FeedRequest");
       
       ...
       
       try
          
          &feedDoc = &feedFactory_inst.getFeedDoc(&request);
          
       catch PTFP_FEED:EXCEPTION:NotFoundException &ex1
          &errorText = MsgGetExplainText(219, 3112, "(Message not found) Not Found");
          
       catch PTFP_FEED:EXCEPTION:PrivilegeException &ex2
          &errorText = MsgGetExplainText(219, 3113, "(Message not found) Not Authorized");
          
       catch PTFP_FEED:EXCEPTION:FeedException &ex3
          &errorText = &utility.getExceptionText(&ex3);
          
       end-try;
       
       /* Create the response message */
       &responseMsg = CreateMessage(Operation.PTFP_GETFEED, %IntBroker_Response);
       
       If None(&errorText) Then
          &responseMsg = &utility.setMessageHeadersAndMimeType(&responseMsg, &feedDoc, &request);
       Else
          &temp = "<?xml version='1.0' encoding='UTF-8'?><ErrorMessage>" | &errorText | "</ErrorMessage>";
          &xmlDoc = CreateXmlDoc(&temp);
          &responseMsg.SetXmlDoc(&xmlDoc);
          &responseMsg.SegmentContentType = &utility.MIMETYPE_XML;
       End-If;
       
       Return &responseMsg;
       
    end-method;

Creating paged feeds also requires additional steps.

Note: Paged feeds are supported for scheduled feeds only. The framework supports paged feeds via Integration Broker message segments. %MaxMessageSize is recommended when creating Integration Broker message segments for paged feeds.

You must complete the following tasks when creating paged feeds:

  1. Define the DSPARAMETER_SF_PAGING data source parameter found in the PTFP_FEED:UTILITY:Utility application class and set it to an appropriate value in your implementation of the processSettingsChange method for your data source.

    For example:

    /* PAGING parameter */
    &thisDSP = %This.addParameter(&utility.DSPARAMETER_SF_PAGING, String(&utility.SF_PAGINGOPTION_NOPAGING));
    &thisDSP.Name = &thisDSP.ID;
    &thisDSP.Description = MsgGetText(219, 3007, "Message Not Found - Page Size");
    &thisDSP.FieldType = &utility.FIELDTYPE_SIGNEDNUMBER;
    &thisDSP.DefaultValue = String(&utility.SF_PAGINGOPTION_NOPAGING);
    &thisDSP.Value = &thisDSP.DefaultValue;
    &thisDSP.Required = True;
    

    Important! The paged feed option is incompatible with the incremental feed option. Do not allow both options to be set simultaneously.

  2. Modify the associated advanced feed options page to allow feed administrators the ability to set this option.