Hi all,
i'm currently trying to retrieve historic information alarms via the repository API in a protocol to compare these to data in a different connector. The code to retrieve the alarms currently looks like this:
var repoReg = DatabaseRepositoryRegistryBuilder.Default.
WithConnection(protocol.SLNet.RawConnection).
Build();
var infoRepo = repoReg.Get<IInfoRepository>();
AlarmFilterItemString test = new AlarmFilterItemString(AlarmFilterField.ElementID, AlarmFilterCompareType.Equality, new[] { "13002/9286" });
var infoFromRepo = infoRepo.Read(new AlarmFilter(new AlarmFilterItem[] { test }), DateTime.Now.AddDays(-2), DateTime.Now)
.Cast<Info>()
.ToList();
Unfortunately this leads to a strange exception:
Code: 0x80131500) Skyline.DataMiner.Net.Exceptions.DataMinerException: Unexpected exception occurred ---> SLDataGateway.API.Types.Exceptions.ClientException: Session 0f8cf951-52bf-4817-b728-d98719cb1bc3 is no longer available
at SLDataGateway.API.Paging.PagingHandlers.AggregatePagingHandler`1.PrefetchItems()
Due to the lack of documentation of the repository API i'm not sure if the code is even correct in this way.
Any help would be appreciated.
Thanks in advance!
Best regards
Manuel
Hi Manuel,
The documentation about the repository API is indeed lacking, I will make sure to follow up on this internally.
I am able to query and filter the information events using the following code, could you try if this works?
var repositoryRegistry = DatabaseRepositoryRegistry.Builder.WithConnection(protocol.SLNet.RawConnection).WithName("InformationEventsQuery").Build();
var infoRepo = repositoryRegistry.Get<IInfoRepository>();
var infoEventsBetween = InfoExposers.TimeOfArrival.GreaterThanOrEqual(DateTime.UtcNow.AddDays(-1))
.AND(InfoExposers.TimeOfArrival.LessThanOrEqual(DateTime.UtcNow))
.AND(InfoExposers.ElementID.Equal(21)); // Fetch the information events for elements with ID 21 and of the last 24H.var someInfoQuery = infoEventsBetween.OrderBy(InfoExposers.TimeOfArrival)
.WithExecutionOptions(options => options.WithTargetHop(QueryTargetHopOptions.All));var infoEvents = infoRepo.CreateReadQuery(someInfoQuery).SetTimeout((int)TimeSpan.FromMinutes(60).TotalMilliseconds).Execute().ToList();
Hi Manuel, which DataMiner version are you running on?
Dataminer Version is 10.2.0.0-11517. But I just spotted an insufficient memory exception in another driver and therefore restarted the agent. That eliminated the error message and also your provided code is working now.
That’s good news, glad I could help!
Hi Jens,
many thanks for you help on this!
I just tried your provided code with only adjusting the element id but unfortunately the result is still the same. So no result but just the same error message in the logs as mentioned in my initial post: Skyline.DataMiner.Net.Exceptions.DataMinerException: Unexpected exception occurred —> SLDataGateway.API.Types.Exceptions.ClientException: Session 0f8cf951-52bf-4817-b728-d98719cb1bc3 is no longer available. The protocol used for this is also the absolute basic. Just Timer-> Group -> Action – > Param -> QAction with the repository API code.