Real time measurement update for a specific device

Hello All,

I ma working on a use case where i need to act on every new measurement received by a device and do some calculation .

I am trying to build microservice and find a suitable example on git hub given by Software AG .

“realtime example in cumulocity-microservice-templates”

I meant over here , i will create my onw application but use the existing onMicroserviceSubscriptionAddedEvent and registerForMeasurementUpdates

Can i use the same one and put my calculation code only or do i need to developed similar subscription logic in my own class including all other work it is doing. like
tenant validation , token

Please suggest

Thank you in advance.

Yes, you can certainly do that.

I’d recommend to just start from the template as-is, then add your custom logic to the event listener:

Please, be advised, though, that the Notification 2.0 API aims to replace the current Realtime API.
AFAIK, there is no template for that, though.

Thanks for your response Chirstoph,

I have few questions. It will help me in implementing my solution better.

  1. Can i filter out this notification on the basis of of device_type like
    type= “xyz_raw”
    fragmentValue = “xyz_raw”

I have 100 device , out of 100 , 50 belongs to “xyz_raw” type and 50 belongs to some other type.
This will reduce my listener load.

  1. will it be able to handle 50 different measurement/sec for same device as the device is having 50 measurement.

  2. Some documentation about properties file and cumulocity.json – so that i can understand it better
    like in properties file
    use of

Looking for your support and response.

Can we filter out my measurement subscription on the basis of device type like type = “xyz_raw”
fragmentValue= “xyz_raw”

It will improve my execution as currently i am filtering it like below

if (measurement.getType().toString().equalsIgnoreCase("xyz_raw")) {

Hi @johndoe, about the question 3, here are the documents you need:
For properties please check: Microservice SDK for Java - Cumulocity IoT Guides
For manifest (cumulocity.json): General aspects - Cumulocity IoT Guides

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.