Skip to content

Synchronous Wrapper

Julien Eberle edited this page Oct 14, 2016 · 1 revision

ZeroMQ Synchronous Wrapper

This wrapper allows for connecting to any local and remote virtual-sensor. Each connection is synchronous and the publisher will wait for the acknowledgement of the subscriber before sending the next stream-element. Subscribers can ask to restart the stream at a given timestamp. It is slower than the asynchronous communication, but more reliable. 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-sync">
				<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-sync">
				<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