Get the size of group activities in aggregated feeds - getstream-io

When using Aggregated Feed, How can I fetch the size of all activities in a Group of Activity?
As the official documents mentioned "Each activity group inside an aggregated feed contains the 15 most recent activities. If you add more than 15 activities to one group, older activities will no longer be visible. Enterprise customers can contact support to increase this limit.", there is a limit of 15 in getting activities.
Is there any way to fetch length of activities in a group?

In short, no.
It returns what it can hold (# of activities in the groups you get). If your limit is increased, it will be higher but it can't include the number of activities that are dropped from the group.
This is a well-known issue and its behavior will be improved to count for all activities, irrespective of their state in group right now.

Related

Pulling more than 10 records for proof of delivery API from NetSuite

Is there any way we can pull more than 10 records from workwave POD Api for more than 10 records?
Whenever I call workwave API through Map/Reduce script it's giving me an error message to slow down. Has anyone got this experience and how they did they manage to achieve this?
Thanks
If you're using the List Orders or Get Orders API, there is a throttling limit - "Leaky bucket (size:10, refill: 1 per minute)". However, both those APIs allow for retrieving multiple orders in a single call. My suggestion would be to restructure your script so that instead of making the call to Workwave in the reduce stage for a single order, you make it in the Get Input Data stage for all orders you want to operate on, and map the relevant data to the corresponding NetSuite data in the Map stage before passing in through to the Reduce stage.
In other words, you make one call listing multiple order ids rather than multiple calls listing one order id.

How can I aggregate data in Time Series Insights preview using the hierarchy?

I am storing 15 minute electricity consumption measurements in a TSI preview environment. Is it possible to aggregate the total energy consumption per day of multiple meters using the TSI query API?
I have configured a hierarchy as Area-Building and the Time Series ID is the 'MeterId' of the Meter.
The query API (https://learn.microsoft.com/en-us/rest/api/time-series-insights/preview-query#aggregate-series-api) enabled me to aggregate to consumption per day for a single meter. Then I expected to find an API to aggregate the electricity consumption to Building and Area, but could only find the aggregate operation with a single "timeSeriesId" or "timeSeriesName" as required parameter. Is aggregation to a level in the hierarchy not possible? If not, what would be a good alternative (within or outside TSI) to obtain these aggregated values?
What you may do, is get all the instances you need with the search api(docs).(mind that the documentation is wrong for the
url, it should contain "search" instead of "suggest" like this:
)
Then loop through the instances you get in the response to call the aggregates by id one by one. And finally sum the results yourself to have a daily result for all the telemetry sensors responding to your search.
Note: You can only make 9 aggregate calls at the same time(limitations).
I hope they fix aggregates soon.
In the meanwhile I hope it helps you out.
Good luck,

Correlating Events in Stream Analytics

I have a number of events that are based on values from devices. They are read in intervals, e.g. every hour. The events are delivered to an Event Hub, which is used as an input to a Stream Analytics (SA) job.
I want to aggregate and calculate an average value in SA. Currently, I aggregate and group the events in SA using an origin id and other properties to create the correct groups and averages. The problem is that the averages are not correct. I think the events a either not complete and/or not correlated correct.
Using a TumblingWindow will produce a number of static windows based on time, but the events I need to aggregate might come across two or more windows.
Using a SlidingWindow, as I understand, will trigger output upon a specific condition and the "look back" for a specified interval. Is this correct? If it is correct, I could attach the same id, like a JobId, to each event that I need aggregated and a value indicating whether it is the last event. When the last event enters SA, the SlidingWindow is triggered and we can "look back" for all the events with the same id. Is this possible? 
Are there other options in this case? Basically I need to correlate a number of events based on other characteristics than time.
I hope you can help me.

Truncate feeds in getStream

I would like to limit the number of feed updates (records) in my GetStream app. I want to keep each feed at a constant length of 500 items.
I make heavy use of the 'to:' field, which results in a lot of feeds of different lengths. I want them all to grow to 500 items, so I would rather not remove items by date.
For what it's worth, I store all the updates in my own database which results in a replica of the network activity.
What would be a good way of keeping my feeds short?
There's no straightforward way to limit your feeds to 500 items. There's 2 ways to remove activities from Stream:
the removeActivity method, which will remove 1 activity at a time via the foreign_id or activity id (https://getstream.io/docs/js/#removing-activities)
the "Truncate Data" button on the dashboard for your app, which will remove all activities in Stream.
It might be possible to get the behavior you're looking for by keeping track of all activities that you're adding to Stream, then periodically culling the ones that put you over 500.
Hopefully this helps!

Event Sourcing Choregraphy that Relate to Multiple Records

I am trying to develop microservices for order / transaction process using event sourcing concept. The staff could place an order / transaction for a customer by phone. The system also record the number of order that grouped by customer. It is using AWS Kinesis to send the customer id in orderCreated event to the service of customer data so we could increment the number of created order. We separate the order processing and customer based on DDD concept. But, we should anticipate human error when staff select wrong customer id for the order. So, there is a feature to change the customer for related order.
The problem is the orderUpdated event just contains the latest data of the order. It means that the event only has the new customer id. We could increment the number of order for new customer. But, we should decrement the number of order for previous customer id.
How to solve this problem? Could you give me some suggestions?
Thanks in advance
It sounds like an OrderUpdated event is not granular enough to meet your needs. Based on the information you provided, you likely want to have a more specific event like OrderCustomerChanged that contains both the new and the old customer Id.

Resources