Cumulocity - How to clear Events for a specific device via REST? - cumulocity

How can I clear/delete all events for a specific device and a specific event type? I tried the a DELETE .../event/events?source=123456&type=c8y_LocationUpdate but this doesn't work.

Mass deletion of events is not allowed. Only one event can be deleted at a time with:
DELETE .../event/events/<id>
Alternatively retention rules can be set to delete events older than X days.

I don't why it isn't working for you but I delete my events using the syntax you provided, d4rty:
DELETE <tenant ID>/event/events?source=12345
and it's working just fine.

Related

Odoo Automation On Update Run More than Once, How To Restrict?

I'm currently using Odoo 12.0+e-20181025 and I'm currently using the Automated Action feature of it to send email whenever the ticket has been updated by someone. I put two different actions, one is to send an email while the other is to make an internal log in the internal log (logger) of the ticket.
The on update domain is as the following:
["&",["user_id","!=",False],["team_id","!=",False]]
At first, it works. But then I noticed that some of them tend to be activated more than once, six (6) times to be exact. As I tried to look for the culprit, I found that it was whenever I choose the "Assigned to" field and/or "Helpdesk Team" field. For some reason I don't know, every time I changed them, the system perceived it as more than one update. It will work normal on any other field.
Can anyone help me how to either (1) make my domain in the automated action work only once each time or (2) how to make the system read my action of filling the field as only one update.Any help is greatly appreciated.
Thank you
Here is what I suggest to restrict multiple attempts from scheduled action.
Add a flag (boolean) field on your target object,
When a scheduled action is executed, search only flag = False,
Afterwards, when you done with event email send, update current record set with flag = True
Now, flag = True will never fetch by scheduled action --- see 2nd point.

RavenDb: OnBeforeStore / OnAfterSaveChanges not firing when perfoming Patch or Add Attachment

I want to make sure that every time I make a change to a document, a certain action is performed. For this I wanted to use OnBeforeStore or OnAfterSaveChanges.
Unfortunately, these two events are not triggered when I save a change via patch or add/delete an attachment.
We use the CQRS pattern and have several commands making changes to entities / collections. I need a central place to execute every change to a particular collection, no matter which command is used.
Is there such a thing in RavenDB?
There is no "central place" that track every change to collection.
About the OnAfterSaveChanges event, it should fire on those actions too.
https://issues.hibernatingrhinos.com/issue/RavenDB-13906

Listing current Ignite jobs and cancelling them

I got a partial answer here but not exactly what I wanted.
The link describes how to get a list of task futures but what I'd really like to be able to do is list out and cancel individual jobs (that might be hung, long running etc etc). I've seen another post implying that this is not possible but I'd like to confirm (see second link)
Thanks
http://apache-ignite-users.70518.x6.nabble.com/How-can-I-obtain-a-list-of-executing-jobs-on-an-ignite-node-td8841.html
http://apache-ignite-users.70518.x6.nabble.com/Cancel-tasks-on-Ignite-compute-grid-worker-nodes-td5027.html
Yes, this is not possible and actually I'm not sure how this can be done in general case. Imagine there are 5 jobs running and you want to cancel one of them. How are you going to identify it? It seems to be very use case specific to me.
However, you can always implement your own mechanism to do this. One of the possible ways is to use ComputeTaskSession API and task attributes. E.g., set a special attribute that will act as signal for job cancellation and create attribute listener that will stop job execution accordingly.

Cumulocity API call with Device Group or Device Type or multiple source

I would like to call the event/alert API but filter the results by Device Type or Device Group, or as a last resort with multiple sources. Is there a way to make a sigle call to the API to achieve this result? At the moment I use /inventory/managedObjects with a device type first to get a list of devices, and then loop through the results and make a call to events/alarms for every device but this doesn't seem like a good way to do it.
Currently there is no way to query event and alarm APIs for a collection of source IDs. You can only query by a single ID.
If you are completly unhappy with calling for every device in the group there are two workarouns that come to my mind:
You query all and filter on the client (the more groups you have the worse this method will be).
You can create an event processing rule that adds an additional fragment to every created alarm and event based on the device group (incoming alarm -> check source -> check parents of the source (there is a function findAllManagedObjectParent). E.g. you add:
"myDeviceGroupName": {}
to all alarms and events.
Afterwards you can query the APIs not by source but by fragmentType.

Can I associate a change set with a work item after it has been delivered?

If I deliver a change set to a stream and not associate it with a work item can the change set be associated with a work item after it has been delivered ?
Yes.
The changeset itself is closed upon delivery to the stream.
But its associated work-item(s) is not: you can add or remove one or several work-items in association with the delivered changeset.
That being said, I have a special hook which makes that association mandatory on deliver: ie, you cannot deliver without having first associated your change set first to a Work Item.
I am not sure if that hook is a custom one for my organization, but here is where you can check if it is there:
It is in the Project Area administration, under
Team Configuration /
Operation Behavior /
Source Control /
Deliver (client) /
Preconditions and follow-up actions are configured for this operation /
Require Work Items and comments