Skip to content
Julien Eberle edited this page Apr 25, 2014 · 5 revisions

ZeroMQ Wrapper

As a complement to the remote and local wrapper (and maybe replacement in a future release), this wrapper allows for publishing StreamElements that are produced by a virtual sensor to any subscriber, locally or remotely. 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">
				<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">
				<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