Subscribe to Event Channel on Java application - Cumulocity

I’m trying to subscribe to the Event Channel in a Java Application. I’m trying to instantiate a new Subscriber following the example found here.

How the java client in cumulocity listens to events?

I’m interested in particular at the events happening on a device so what I’m doing is subscribe to the channel “/events/123” where 123 is the device id.

   public static void main( String[] args )
{
   String uRl = "urlOfMyCumulocityIstance"; 
   CumulocityCredentials rC = new CumulocityCredentials("username","password");
   PlatformParameters parameters = new PlatformParameters(uRl,rC,new ClientConfiguration());
   CepCustomNotificationsSubscriber t = new CepCustomNotificationsSubscriber(parameters);
   System.out.println(t.toString() + " - " + t.CEP_CUSTOM_NOTIFICATIONS_URL.toString()); // It prints an integer number corresponding to the subscriber t.

   t.subscribe("/events/123", new SubscriptionListener<String, Object>() {

    public void onError(Subscription arg0, Throwable arg1) {
        // TODO Auto-generated method stub
        System.out.println(arg1.getMessage());

    }

    public void onNotification(Subscription arg0, Object arg1) {
        // TODO Auto-generated method stub
        System.out.println(arg1);

    }

   });

}

Nevertheless I’m not getting any of the events sent to the device.

To sum up, what I’d like to do is what in Apama you do by typing

monitor.subscribe(Event.CHANNEL)
on all Event(source=123) as e 
{
   // do something
}

Any idea about it? Thank in advance

I would like to know the answer of this too. CepCustomNotificationsSubscriber is used to subscribed to notifications from custom cep rules and not the root interfaces.

I couldn’t find the appropriate java classes and methods to listen to “/events/", "/measurements/”, “/alarms/*” etc.

Hi Chris,
Just curious, did you found any solution for listening events and measurements?

Thanks
Nirmal