Skip to content
sarni edited this page Feb 25, 2014 · 3 revisions

The remote wrapper is used for communication between two different GSN instances (both instances should run exactly the same revision of GSN).

The remote-streaming wrapper a the new wrapper which is design to have a persistent connection therefore addressing performance and firewall issues. Contrary to the push-wrapper which establishes a new connection to the remote host (can be expensive when the data rate is high), the streaming remote wrapper, establishes the connection to the remote host only once and keeps it alive during the whole life-cycle of the consumer thus reduceing the load on the system for high-data rate virtual sensors. As the connection is established from the client to the producer, this also resolves the firewall issue of having the client behind the NAT.

In order to use this wrapper, one needs to have both sides using the same code base (the same revision).

Parameters:

  • query This is a sql query sent to perform filtering at the source. This query can only contain one single table (no joins, self-joins, inner-selects) and basic filtering (no aggregation, group by, having, database specific key words. Notice that if you don't specify the TIMED field in your query (eg. select HEAP, NON_HEAP from memorymonitorvs) then the time assigned to the data will be the current time.
  • start-time The system starts downloading the historical data. Once the historical items delivered, the data producer sends the real time data as they get produced. In the case of restful version of remote wrapper, the connection will be kept alive. If the connection is lost, the local GSN reties to connect to the remote host every 3 seconds.
  • username Used if the remote host requires authentication before accepting requests.
  • password Used if the remote host requires authentication before accepting requests.
  • remote-contact-point The address of the GSN's streaming URL. the default value is http://MachineNameOrIP:Port/streaming/

Example:

<source alias="source1" sampling-rate="1" storage-size="1">
  <address wrapper="remote-rest">
    <predicate key="query">select * from MemoryMonitorVS</predicate>
    <predicate key="remote-contact-point">http://localhost:22001/streaming/</predicate>
    <predicate key="start-time">2009-02-06T11:56:10.004+02:00</predicate>
  </address>
  <query>select HEAP ,(NON_HEAP-10000) as NON_HEAP,PENDING_FINALIZATION_COUNT,TIMED from wrapper</query>
</source>

Example output (command line):

Note that, if you want to use command line tools, you need to have your URL encoded (see http://en.wikipedia.org/wiki/Percent-encoding)

  • start-time: 2009-02-06T11:56:10.004+02:00

  • query: select * from MemoryMonitorVS

  • query encoded: select%20*%20from%20MemoryMonitorVS (encoded through online tools like http://meyerweb.com/eric/tools/dencoder/)

  • start-time encoded: 2009-02-06T11%3A56%3A10.004%2B02%3A00 (encoded through online tools like http://meyerweb.com/eric/tools/dencoder/)

  • final url: http://server:port/streaming/select%20*%20from%20MemoryMonitorVS/2009-02-06T11%3A56%3A10.004%2B02%3A00

now, issue

curl http://server:port/streaming/select%20*%20from%20MemoryMonitorVS/2009-02-06T11%3A56%3A10.004%2B02%3A00

A sample output:

 <strcture-array>
    <strcture>
      <description>Not Provided</description>
      <name>HEAP</name>
      <dataTypeID>5</dataTypeID>
      <type>Double</type>
    </strcture>
    <strcture>
      <description>Not Provided</description>
      <name>NON_HEAP</name>
      <dataTypeID>5</dataTypeID>
      <type>Double</type>
    </strcture>
    <strcture>
      <description>Not Provided</description>
      <name>PENDING_FINALIZATION_COUNT</name>
      <dataTypeID>5</dataTypeID>
      <type>Double</type>
    </strcture>
  </strcture-array>
  <stream-element timestamp="2009-07-09 10:06:00.813 CEST">
    <field name="HEAP" type="numeric">9095304.0</field>
    <field name="NON_HEAP" type="numeric">1.3158464E7</field>
    <field name="PENDING_FINALIZATION_COUNT" type="numeric">0.0</field>
  </stream-element>
  <stream-element timestamp="2009-07-09 10:06:01.830 CEST">
    <field name="HEAP" type="numeric">1.04974E7</field>
    <field name="NON_HEAP" type="numeric">1.316424E7</field>
    <field name="PENDING_FINALIZATION_COUNT" type="numeric">0.0</field>
  </stream-element>
  <stream-element timestamp="2009-07-09 10:06:02.889 CEST">
    <field name="HEAP" type="numeric">1.28316E7</field>
    <field name="NON_HEAP" type="numeric">1.3168472E7</field>
    <field name="PENDING_FINALIZATION_COUNT" type="numeric">0.0</field>
  </stream-element>
  <stream-element timestamp="2009-07-09 10:06:03.909 CEST">
    <field name="HEAP" type="numeric">1.4176376E7</field>
    <field name="NON_HEAP" type="numeric">1.3205712E7</field>
    <field name="PENDING_FINALIZATION_COUNT" type="numeric">0.0</field>
  </stream-element>
  <stream-element timestamp="2009-07-09 10:06:04.936 CEST">
    <field name="HEAP" type="numeric">4496136.0</field>
    <field name="NON_HEAP" type="numeric">1.3237824E7</field>
    <field name="PENDING_FINALIZATION_COUNT" type="numeric">0.0</field>
  </stream-element>
  <stream-element timestamp="2009-07-09 10:06:05.946 CEST">
    <field name="HEAP" type="numeric">5772016.0</field>
    <field name="NON_HEAP" type="numeric">1.3237824E7</field>
    <field name="PENDING_FINALIZATION_COUNT" type="numeric">0.0</field>
  </stream-element>
  <stream-element timestamp="2009-07-09 10:06:06.959 CEST">
    <field name="HEAP" type="numeric">8025704.0</field>
    <field name="NON_HEAP" type="numeric">1.3238976E7</field>
    <field name="PENDING_FINALIZATION_COUNT" type="numeric">0.0</field>
  </stream-element>
...
Clone this wiki locally