Skip to content

Asynchronous Wrapper

Julien Eberle edited this page Oct 14, 2016 · 2 revisions

ZeroMQ Asynchronous Wrapper

This wrapper allows for subscribing to any local and remote virtual-sensor. Published stream-elements are never re-published and the publisher will not adapt its throughput to the consumers. It trades the reliability (if the receiving server is down, it won't be able to catch up what was generated during this time) with performances (see the full experiments). It behaves transparently with local and remote connection, using the inproc or tcp transports. An internal proxy takes care of the external tcp connections and informing them about the data structure.

For example the following stream is defined to subscribe to the virtual sensor MemoryMonitorVS on the remote machine 192.168.1.101, using the ports 22022 for the data (optional) and 22023 for the metadata (optional).

<streams>
	<stream name="input1">
		<source alias="source1" sampling-rate="1" storage-size="1">
			<address wrapper="zeromq-async">
				<predicate key="address">tcp://192.168.1.101</predicate>
				<predicate key="data_port">22022</predicate>
				<predicate key="meta_port">22023</predicate>
				<predicate key="vsensor">MemoryMonitorVS</predicate>
			</address>
			<query>select * from wrapper</query>
		</source>
		<query>select * from source1</query>
	</stream>
</streams>

and this one is listening to the local virtual sensor MemoryMonitorVS:

<streams>
	<stream name="input1">
		<source alias="source1" sampling-rate="1" storage-size="1">
			<address wrapper="zeromq-async">
				<predicate key="address">inproc://stream/MemoryMonitorVS</predicate>
				<predicate key="vsensor">MemoryMonitorVS</predicate>
			</address>
			<query>select * from wrapper</query>
		</source>
		<query>select * from source1</query>
	</stream>
</streams>

The proxy and publishing to zeromq endpoint are disabled by default and can be enabled by adding the lines below in the file conf/gsn.xml. The two first options sets the ports used for the proxy for sending data and for the metadata.

   <zmqproxy>22022</zmqproxy>
   <zmqmeta>22023</zmqmeta>
   <zmq-enable>true</zmq-enable>
Clone this wiki locally