Aruba Apps

Occasional Contributor I
Posts: 7
Registered: ‎03-15-2016

Sample java code for ALE feed reader (protobuf over ZMQ)


We are doing some integration between our system and ALE server to read AP and subscriber related stats through protobuf over ZMQ. I wonder if I can get hold of any sample C or Java code to for the feed reader from ALE. We have tried to do the same using python and we are getting empty fields returned.

Any hints would be helpful.





Posts: 514
Registered: ‎11-04-2011

Re: Sample java code for ALE feed reader (protobuf over ZMQ)


I'm not a developer, there is a section ZeroMQ Application Sample code which seems 'C' to me in the ALE 2.0 User Guide that can be found here:


Does this help you??


What also may be useful is to see if ALE is generating events. That can be easily done with the feed-reader command on the ALE server:


[root@ale ~]# /opt/ale/bin/feed-reader
Attempting to 'connect' to endpoint: tcp://localhost:7779
Connected to endpoint: tcp://localhost:7779
Subscribed to topic: ""
[1] Recv event with topic "presence"
seq: 2547170
timestamp: 1458212356
topic_seq: 112229

If you you don't see events there, the ALE might nog get any data.. so make sure ALE is getting data first.




If you have urgent issues, please contact your Aruba partner or Aruba TAC (click for contact details).
Occasional Contributor I
Posts: 7
Registered: ‎03-15-2016

Re: Sample java code for ALE feed reader (protobuf over ZMQ)

Thanks Herman. I am using a python script to do the job.

Things seem to be working right and we are able to connect and subscribe but we are gettting the data once and that's it. We are not seeing the data coming in consistently. We are using NULL security as far as ZMTP is concerned. 


Has anyone got a working python script for this?



New Contributor
Posts: 1
Registered: ‎11-10-2016

Re: Sample java code for ALE feed reader (protobuf over ZMQ)

I'm in the same situation, but with PHP.... After two days of server configurations and proto file modifications (PHP need a proto3 version of the schema.proto, I've attached my version to this post) ... I'm now able to connect and subscribe to topic and I receive some event labeled as (ex: location\18:1d:1f:11:a1:fw ) ... but the next received zmq message is empty ... Like if data is hidden by an hidden security mechanism...

Do we need to send auth data, config certs , achieve a tunnel between me dev server and the ale ?!?!?? or something else ? Aruba please give us more hints and documentation about how we are suppose to make this work !

On your side, did you've been able to achieve something in Rubby ? I was thinking to give it a try with Java or Rubby... But I think my problem is not language related...

I've got the feeling of deeping in nothing... the doc is, at my thougth , insuffisant to help developpers get things work...

Here is my current PHP script to collect location feed message from ZMQ...

$context = new \ZMQContext();
$subscriber = new ZMQSocket($context, ZMQ::SOCKET_SUB);
$subscriber->setSockOpt(ZMQ::SOCKOPT_SUBSCRIBE, "location");

$conn = $subscriber->connect("tcp://x.x.x.x:7779");

while (true) {
$adresse = $subscriber->recv();
$contents = $subscriber->recv();
// I've done this as the second recv function return an empty string as bytes
error_log(vsprintf(str_repeat('%c', count($contents)), $contents));

/* ****** ERROR LOG OUTPUT ******
[10-Nov-2016 16:08:02 UTC] location/18:1d:1f:11:a1:fw
[10-Nov-2016 16:08:02 UTC]
*/ ****** ERROR LOG OUTPUT ******


 Simon Rousseau

New Contributor
Posts: 1
Registered: ‎05-09-2017

Re: Sample java code for ALE feed reader (protobuf over ZMQ)

import org.zeromq.ZMQ;
import org.zeromq.ZMQ.Context;
import org.zeromq.ZMQ.Socket;

import com.aruba.ale.proto.Schema.nb_event;

public class SampleAleFeedReader {

	public static void main(String[] args) throws IOException {
		Context context = ZMQ.context(1);

		Socket socket = context.socket(ZMQ.SUB);
		socket.subscribe("".getBytes()); // subscribe to all available topics

		byte[] currByte = null;
		String currentAddress = null;
		while (!Thread.currentThread().isInterrupted()) {
			currentAddress = socket.recvStr(0);
			currByte = socket.recv(0);

			while (socket.hasReceiveMore()) {
				System.out.println("multi-part zmq message ");
				byte[] moreBytes = socket.recv(0);
				currByte = Bytes.concat(currByte, moreBytes);


Here's a snippet that works for me!

Search Airheads
Showing results for 
Search instead for 
Did you mean: