How do I retrieve failed journal entries when syncing from IDS to QBD? - intuit-partner-platform

I am creating two Journals in IDS using JournalEntry POST, out of which only one journal is syncing and appearing in QBD.
I tried to retrieve the failed journal by querying for ErroredObjectsOnly="true", but got an error - Attribute 'ErroredObjectsOnly' is not allowed to appear in element 'JournalEntryQuery'
I tried setting ObjectStateEnable to true in the query, but the result contains only journals that have been successfully synced.
Retrieve all only returns journals that are successful.
Is there any way by which I can retrieve the failed journal entries?

Related

How to cache firestore documents in flutter?

I want to store documents that I download from firestore. Each document has a unique id so I was thinking of a way I can store that document in json format or in database table (so I can access its fields) and if that id is not present in the memory than just simply download it from firestore and save it. I also want these documents to be deleted if they are not used/called for a long time. I found this cache manager but was unable to understand how to use it.
you can download the content by using any of the flutter downloadmanager and keep the path of the downloaded content in sqllite and load the data from local storage rather than url if the data is already saved.
Following pseudo-code may help you:
if(isDownloaded(id)){
//show from local;
} else {
// show from remote
}
you can manually check whether the resources are being used or not by keeping a timestam of it and update the timestamp only when it is shown. and you can run a service which looks for the unused resources and delete it from storage and the databse too.

Cloudkit Query Error throw System Type error

I have been trying to query a cloudkit container having few fields under Record Types Users. After all the authentication it throws an error as Can't Query System Types.
I am working on Javascript code and referring the Cloudkit catalog.
I am new to cloudkit and created few fields under Users and mark them as query-able also but not sure why getting such error.
Any help.
CloudKit doesn't let you query the Users table to pull multiple records. You can only query by recordName (one at a time).
See this post for more details: Querying CloudKit Users Record gives "Can't query system types"
As a workaround, I created my own User record type in the Public Database so I could make queries against it. It has worked pretty well so far.

In Couchbase, expired document included to query view list with NULL contents

Recently we started to use couchbase, We are using java spring-data-couchbase with Jersey to access couchbase. Accessing low level java-sdk-api we set expire time (TTL) to a particular document with the KEY(id). It's working fine. The code is as follows.
// define couchbaseTemplate for lower-level access to Java SDK
#Autowired
CouchbaseTemplate couchbaseTemplate;
// setExpiry method update expiry given a doc ID
#Override
public void setExpiry(String key, int expN) throws RepositoryException {
couchbaseTemplate.getCouchbaseClient().touch(key, expN);
}
The problem we face is when we try to get list of documents using query, the list contains the expired documents. And when we try to access the documents from the list we found it to be null.
But if we execute query after a while the expired document no longer include to the list.
Example: When the expN = 10 seconds, and we execute query around 10 seconds after setting the TTL, the expired documents included
If we execute query around 20 seconds after setting the TTL, the expired documents no longer included
in stale options we set
Query.setStale(Stale.false)
We have tried to manipulate
Query.setIncludeDocs
But no luck, any help....
Couchbase Server does expiries lazily. There are three ways an item can be expired:
When a document is accessed (get operation) the expiration value is checked
When the expiry pager runs
When disk compaction process runs (Only in Couchbase Server 3 and onwards)
As a result of this views will not be updated until one of these three processes has happened.
For this use case you could simple do a range query against the view using the current time so it only returns documents that have not expired. Assuming the time is the same on the cluster are well as the client and the view being used is this one:
function (doc, meta) {
emit(meta.expiration, null);
}
The meta.expiration is an epoch timestamp, so the following query could be used:
String currentEpoch = String.valueOf((System.currentTimeMillis()/1000));
bucket.query(ViewQuery.from("designdoc", "myview").startkey(currentEpoch));
Please note that this will return all alive documents that have an expiration set.
If you want to do something more interesting with date formats have a look at the Date and time selection half way down in the View and query examples chapter in the Couchbase Server manual.
As the Couchbase official documents said,
Detecting Expired Documents in Result Sets : If you are using views for indexing items from Couchbase Server, items that have not yet been removed as part of the expiry pager maintenance process will be part of a result set returned by querying the view. To exclude these items from a result set you should use query parameter include_doc set to true.
For expired documents, if you set include_doc=true , Couchbase Server returns a result set indicating the document does not exist anymore. Specifically, the key that had expired but had not yet been removed by the cleanup process will appear in the result set as a row where "doc":null :
So, this is how Couchbase works with expired documents.
For your case, just filter out the items where the doc is null, the rest will be your expected result.

Retrieve the list of UIDs in an Imapfolder with MailKit?

I want to send the command 'UID FETCH ALL'. This gives me all the uids for this folder. I can't find any predefined method for this command.
I want to retrieve the headers of the emails in an imapfolder and save them to a local datastore with their UID so the next time, I can fetch all the UIDs, discard the ones smaller then the highest UID in my datastore and start retrieving those headers.
Additionally I can compare the range of UIDs in my datastore with the list retrieved by the command and check if any UIDs failed to be persisted to my local datastore en try to receive them again.
(Assume checking of the UIDs is in conjunction with UIDValidity).
I use this strategy to be sure all headers are in my local datastore (or my logging tells me which UID I can not retrieve/persist)
If there is another (possible better) strategy to accomplish this with MailKit please point me in the right direction.
Update:
Found a solution. Use 'inbox.Fetch(0, -1, MessageSummaryItems.UniqueId)'
Found a solution. Use 'inbox.Fetch(0, -1, MessageSummaryItems.UniqueId)'

How to recover a core data document when its state is UIDocumentStateSavingError.

I am using a file as the repo of my core-data. When trying to open it, I get a failure with the document state set to integer 5 (UIDocumentStateSavingError & UIDocumentStateClosed). How do I recover such a document, either by resolving the error or forcing the document to open as is.