Announcement

Collapse
No announcement yet.

Message update problem

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Message update problem

    I recently had to define a Custom Reader based on "Vizrt.Socialize.Plugins.XML_JSON.xml" to read an xml source that had individual entries structured like this:
    Code:
    <Sports>
          <league_name1>FBCIML</league_name1>
          <vt_rank></vt_rank>
          <forced_visit_team>Johnston</forced_visit_team>
          <visit_score>13</visit_score>
          <vt_winner>Y</vt_winner>
          <ht_rank></ht_rank>
          <forced_home_team>Ankeny Centennial</forced_home_team>
          <home_score>8</home_score>
          <ht_winner></ht_winner>
          <forced_period>F</forced_period>
          <notes_all></notes_all>
          <updated>2017-08-25 22:18:41</updated>
      </Sports>
    My Custom Reader looks like this:
    Code:
    <Reader Name="FBCIML">
      <Image>Resources/icons/FBFRI.png</Image>
      <Attributes>
        <Attribute>
          <Key>IsFeedReflectionOptional</Key>
          <Value>True</Value>
        </Attribute>
      </Attributes>
      <Request>
        <Url>{url}</Url>
        <Parameters>
          <Parameter Mandatory="True">
            <Name>{url}</Name>
            <Caption>Feed Url</Caption>
            <Type>textbox</Type>
            <Value></Value>
          </Parameter>
        </Parameters>
      </Request>
      <Response>
        <Root>/root/DATA/Sports[league_name1='FBCIML']</Root>
        <entry xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
          <id>CIML {forced_visit_team} vs. {forced_home_team}</id>
          <title>{forced_visit_team} vs. {forced_home_team}</title>
          <summary></summary>
          <author>
            <name>Channel 13 Sports</name>
          </author>
                <content type="application/vnd.vizrt.payload+xml">
            <payload xmlns="http://www.vizrt.com/types">
              <field name="visitor_name">
                <value>{forced_visit_team}</value>
              </field>
              <field name="visitor_score">
                <value>{visit_score}</value>
              </field>
              <field name="visitor_winflag">
                <value>{vt_winner}</value>
              </field>
              <field name="home_name">
                <value>{forced_home_team}</value>
              </field>
              <field name="visitor_score">
                <value>{home_score}</value>
              </field>
              <field name="visitor_winflag">
                <value>{ht_winner}</value>
              </field>
              <field name="period">
                <value>{forced_period}</value>
              </field>
            </payload>
          </content>
          <published>{updated[viztext:replace(., " ", "T")]}-05:00</published>
        </entry>
      </Response>
    </Reader>
    The reader worked, but I noticed that, although I had included a <RefreshRate> element to the "Response", the messages did not update, even though there was a change in the score. New messages arrived according to the "RefreshRate" schedule (in this case, every 2 minutes), but messages that were already in the queue did not update to the new values included in the feed.

    I noticed that the time stamp for all the messages is the same on every message, the last time the feed refreshed (most likely generated by the system clock).

    The only way I could get the scores to update was to uncheck “Auto-Approve”, check “Delete old messages” and then check “Auto-Approve” on the source in FeedStreamer.

    I assume there's a problem with the "<published>" element, but I really don't understand what is wrong. Is there something I’m missing?

  • #2
    OK, I now think the problem is in this line:

    Code:
      <published>{updated[viztext:replace(., " ", "T")]}-05:00</published>
    I believe that "<published>" should, in fact, be "<updated>" and I made an error in syntax with the viz extension to xpath . It should read:
    Code:
      <updated>{updated[vizext:replace(., " ", "T")]}-05:00</updated>

    Comment


    • #3
      Not sure if FeedStreamer is supposed to work this way or not, but I found a work-around for my "update" problem:
      I added the "<updated>" time stamp to the "<id>" element:

      Code:
       <id>CIML {forced_visit_team} vs. {forced_home_team} {updated[vizext:replace(., " ", "T")]}-05:00</id>
      This has the effect of adding a new message every time the score gets updated in the feed. By setting "Reflect Feed" to "On", old messages that are no longer in the feed get deleted, so I'm left with only the latest score for each game.

      Maybe this was the way I was supposed to approach the problem in the beginning, but it wasn't clear from reading the documentation.

      Comment

      Working...
      X