How to Capture real-time Events and Alarms using Java web Services

Hello,
Do we have any sample java code for listening real time Events/Alarams? or any help related in this space is muc appriciated.

Thanks
Nirmal

You can use sample codes provided on bitbucket.
https://bitbucket.org/m2m/cumulocity-clients-java

https://bitbucket.org/m2m/cumulocity-clients-java/src/develop/java-client

There are lot of example of events, CEP , alarms etc

Hi Gyan,
The bove links shows me the implementation class for the Jar file which we are importing into the project. I dont see any example over there!!

May I know how do you say that example?

Hello Team,
I’ve created java Eclipse Project for Real time Event Listener and I’ve upload the relevent java file here.

as per the log listerner load intially and grab an event but its not retrieving the Live events

Any help would be much appriciated here!

Subscriptions have been initialized on application startup
The tenant t38579177 is subscribed to this application
Fteched Event object with id 10915978 from tenant t38579177: {“self”:“https://t38579177.iotdev.telstra.com/event/events/10915978",“attrs”:{“c8y_Application__Metadata”:{“owner”:“t38579177”,“tenant”:“t38579177”}},“id”:{“attrs”:{},“type”:“com_cumulocity_model_idtype_GId”,“value”:“10915978”,“name”:null,“long”:10915978},“type”:“c8y_Application__SuccessfulCreate”,“time”:1587977643000,“creationTime”:1587977643573,“text”:"Created pod: measurement-alarms-scope-t38579177-deployment-694cc8d5fb-xs7c9”,“externalSource”:null,“dateTime”:{“year”:2020,“dayOfMonth”:27,“dayOfWeek”:1,“dayOfYear”:118,“era”:1,“centuryOfEra”:20,“yearOfEra”:2020,“yearOfCentury”:20,“weekyear”:2020,“monthOfYear”:4,“weekOfWeekyear”:18,“millisOfDay”:32043000,“minuteOfDay”:534,“secondOfDay”:32043,“hourOfDay”:8,“minuteOfHour”:54,“secondOfMinute”:3,“millisOfSecond”:0,“zone”:{“fixed”:true,“id”:“UTC”},“millis”:1587977643000,“chronology”:{“zone”:{“fixed”:true,“id”:“UTC”}},“afterNow”:false,“beforeNow”:true,“equalNow”:false},“source”:{“self”:“https://t38579177.iotdev.telstra.com/inventory/managedObjects/9237133",“attrs”:{},“id”:{“attrs”:{},“type”:“com_cumulocity_model_idtype_GId”,“value”:“9237133”,“name”:null,“long”:9237133},“type”:null,“name”:“measurement-alarms”,“lastUpdated”:null,“creationTime”:null,“owner”:null,“childDevices”:null,“childAssets”:null,“childAdditions”:null,“deviceParents”:null,“assetParents”:null,“additionParents”:null,“externalIds”:null,“lastUpdatedDateTime”:null,“creationDateTime”:null,“selfDecoded”:“https://t38579177.iotdev.telstra.com/inventory/managedObjects/9237133”},“creationDateTime”:{“year”:2020,“dayOfMonth”:27,“dayOfWeek”:1,“dayOfYear”:118,“era”:1,“centuryOfEra”:20,“yearOfEra”:2020,“yearOfCentury”:20,“weekyear”:2020,“monthOfYear”:4,“weekOfWeekyear”:18,“millisOfDay”:68043573,“minuteOfDay”:1134,“secondOfDay”:68043,“hourOfDay”:18,“minuteOfHour”:54,“secondOfMinute”:3,“millisOfSecond”:573,“zone”:{“fixed”:true,“id”:“+10:00”},“millis”:1587977643573,“chronology”:{“zone”:{“fixed”:true,“id”:“+10:00”}},“afterNow”:false,“beforeNow”:true,“equalNow”:false},“selfDecoded”:"https://t38579177.iotdev.telstra.com/event/events/10915978”}
As expected: error, not in any tenant scope Error creating bean with name ‘scopedTarget.tenantPlatform’: Scope ‘tenant’ is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: Not within any context!
Inside StartThread1 --------------
Inside StartThread2--------------
Inside checkDoorStatus 1--------------
Inside checkDoorStatus 2--------------
Inside checkDoorStatus 3--------------
Inside checkDoorStatus 4--------------
Inside StartThread1 --------------
Inside StartThread2--------------
Inside checkDoorStatus 1--------------
Inside StartThread1 --------------
Inside StartThread2--------------
Inside checkDoorStatus 1--------------
Inside StartThread1 --------------
Inside StartThread2--------------
Inside checkDoorStatus 1--------------
Inside checkDoorStatus 2--------------
Inside checkDoorStatus 3--------------
Inside checkDoorStatus 4--------------
Inside StartThread1 --------------
Inside StartThread2--------------
Inside checkDoorStatus 1--------------
Inside StartThread1 --------------
Inside StartThread2--------------
Inside checkDoorStatus 1--------------
Inside StartThread1 --------------
Inside StartThread2--------------
Inside checkDoorStatus 1--------------
Inside StartThread1 --------------
Inside StartThread2--------------
Inside checkDoorStatus 1--------------
Inside checkDoorStatus 2--------------
Inside checkDoorStatus 3--------------
Inside checkDoorStatus 4--------------
Inside StartThread1 --------------
Inside StartThread2--------------
Inside checkDoorStatus 1--------------
Inside checkDoorStatus 2--------------
Inside checkDoorStatus 3--------------
Inside checkDoorStatus 4--------------
Inside StartThread1 --------------
Inside StartThread2--------------
Inside checkDoorStatus 1--------------
Inside checkDoorStatus 2--------------
Inside checkDoorStatus 3--------------
Inside checkDoorStatus 4--------------
Inside StartThread1 --------------
Inside StartThread2--------------
Inside checkDoorStatus 1--------------
Inside StartThread1 --------------
Inside StartThread2--------------
Inside checkDoorStatus 1--------------
Inside checkDoorStatus 2--------------
Inside checkDoorStatus 3--------------
Inside checkDoorStatus 4--------------
Inside StartThread1 --------------
Inside StartThread2--------------
Inside checkDoorStatus 1--------------
Inside StartThread1 --------------
Inside StartThread2--------------
Inside checkDoorStatus 1--------------
Inside checkDoorStatus 2--------------
Inside checkDoorStatus 3--------------
Inside checkDoorStatus 4--------------
Inside StartThread1 --------------
Inside StartThread2--------------
Inside checkDoorStatus 1--------------
Inside StartThread1 --------------
Inside StartThread2--------------
Inside checkDoorStatus 1--------------
Inside StartThread1 --------------
Inside StartThread2--------------
Inside checkDoorStatus 1----